Skip to content
Snippets Groups Projects
Commit 2212aed1 authored by jan.bednarik's avatar jan.bednarik
Browse files

Rename mutation NewReport to CreateReport.

parent 11849324
No related branches found
No related tags found
No related merge requests found
......@@ -98,7 +98,7 @@ class Logout(relay.ClientIDMutation):
return Logout(success=True)
class NewReport(relay.ClientIDMutation):
class CreateReport(relay.ClientIDMutation):
class Input:
title = graphene.String(required=True)
......@@ -129,7 +129,7 @@ class NewReport(relay.ClientIDMutation):
other_participants=strip_all_tags(input.get('other_participants', '')),
)
return NewReport(report=types.Report.from_db(report))
return CreateReport(report=types.Report.from_db(report))
class Mutation:
......@@ -137,4 +137,4 @@ class Mutation:
login_by_shortcut = LoginByShortcut.Field()
# TODO
# logout = Logout.Field()
new_report = NewReport.Field()
create_report = CreateReport.Field()
......@@ -9,7 +9,7 @@ snapshots = Snapshot()
snapshots['test_unauthorized 1'] = {
'data': {
'newReport': None
'createReport': None
},
'errors': [
{
......@@ -26,7 +26,7 @@ snapshots['test_unauthorized 1'] = {
snapshots['test_full_report 1'] = {
'data': {
'newReport': {
'createReport': {
'report': {
'author': {
'extra': None,
......
......@@ -30,8 +30,8 @@ def call_api(client, query, input, username=None):
def test_unauthorized(client, snapshot):
query = """
mutation newReport ($input: NewReportInput!) {
newReport (input: $input) {
mutation createReport ($input: CreateReportInput!) {
createReport (input: $input) {
report {
id
}
......@@ -51,8 +51,8 @@ def test_unauthorized(client, snapshot):
def test_full_report(client, snapshot):
query = """
mutation newReport ($input: NewReportInput!) {
newReport (input: $input) {
mutation createReport ($input: CreateReportInput!) {
createReport (input: $input) {
report {
id
date
......@@ -95,14 +95,12 @@ def test_full_report(client, snapshot):
# published date is set on save, changing between test runs, so we strip it
# from snapshot
published = response['data']['newReport']['report']['published']
response['data']['newReport']['report']['published'] = '__STRIPPED__'
# There is a strange issue with tests, that report get's ID 2 when all tests
# are run. Even when the there is just one Report in database. I tried to
# debug it, no luck to solve. So I just strip ID from snapshot and check it.
id = response['data']['newReport']['report']['id']
response['data']['newReport']['report']['id'] = '__STRIPPED__'
published = response['data']['createReport']['report']['published']
response['data']['createReport']['report']['published'] = '__STRIPPED__'
# strip random ID from snapshot and check it
id = response['data']['createReport']['report']['id']
response['data']['createReport']['report']['id'] = '__STRIPPED__'
assert re.match(r'\w+', id)
snapshot.assert_match(response)
......@@ -118,12 +116,13 @@ def test_full_report(client, snapshot):
assert report.our_participants == our_participants
assert report.other_participants == other_participants
assert report.extra is None
assert report.is_draft is False
def test_input_sanitization(client):
query = """
mutation newReport ($input: NewReportInput!) {
newReport (input: $input) {
mutation createReport ($input: CreateReportInput!) {
createReport (input: $input) {
report {
id
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment