Fakultas Ilmu Komputer UI

Commit 847daff1 authored by Ilma Ainur Rohma's avatar Ilma Ainur Rohma
Browse files

[REFACTOR] add message in delete mutation

parent db50eef5
......@@ -38,9 +38,15 @@ class DeleteMustahik(graphene.Mutation):
class Arguments:
id = graphene.ID()
message = graphene.String()
idMustahik = graphene.ID()
nama = graphene.String()
noKtp = graphene.String()
mustahik = graphene.Field(MustahikType)
def mutate(self, info, id):
mustahik = Mustahik.objects.get(pk=id)
if mustahik is not None:
mustahik.delete()
_nama = mustahik.name
_no_ktp = mustahik.no_ktp
mustahik.delete()
return DeleteMustahik(message = "Success", idMustahik=id, nama=_nama, noKtp=_no_ktp)
\ No newline at end of file
......@@ -243,6 +243,10 @@ class MustahikGraphQLTestCase(GraphQLTestCase):
id
name
}
message
idMustahik
nama
noKtp
}
}
''',
......@@ -250,7 +254,8 @@ class MustahikGraphQLTestCase(GraphQLTestCase):
self.assertResponseNoErrors(response)
content = json.loads(response.content)
self.assertIsNone(content['data']['deleteMustahik'])
self.assertIsNone(content['data']['deleteMustahik']['mustahik'])
self.assertEquals(content['data']['deleteMustahik']['message'], "Success")
self.assertEquals(Mustahik.objects.count(), count-1)
def test_mustahik_query_can_read_detail_mustahik(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment