From 97b8548393dc655cc38008c2aedab9c187fcabec Mon Sep 17 00:00:00 2001
From: abdurrafiarief <abdurrafiarief@gmail.com>
Date: Fri, 24 Jul 2020 16:47:51 +0700
Subject: [PATCH] [GREEN] complete task for search mustahik with name

---
 sizakat/mustahik/query.py | 4 +++-
 sizakat/mustahik/tests.py | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sizakat/mustahik/query.py b/sizakat/mustahik/query.py
index be4165c..f78221c 100644
--- a/sizakat/mustahik/query.py
+++ b/sizakat/mustahik/query.py
@@ -25,7 +25,9 @@ class MustahikQuery(graphene.ObjectType):
             return mustahik
 
     def resolve_mustahikWithName(self, info, name=""):
-        return
+        if name != "":
+            return Mustahik.objects.filter(name__icontains=name)
+        return Mustahik.objects.all()
         
         
  
diff --git a/sizakat/mustahik/tests.py b/sizakat/mustahik/tests.py
index ea9a47e..ceeba11 100644
--- a/sizakat/mustahik/tests.py
+++ b/sizakat/mustahik/tests.py
@@ -316,7 +316,7 @@ class MustahikGraphQLTestCase(GraphQLTestCase):
         self.assertEqual(len(content['data']['mustahikWithName']),1)
         self.assertEqual(content['data']['mustahikWithName'][0]['name'], 'mustahik')
 
-    def test_mustahikWithName_if_name_is_set_should_return_list_of_mustahiks_with_contain_the_name(self):
+    def test_mustahikWithName_if_name_is_set_should_return_list_of_mustahiks_that_contain_the_name(self):
         Mustahik.objects.create(
             name='test',
             no_ktp='11751234567890',
-- 
GitLab