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