@@ -8,8 +8,10 @@ class testCasesForStudents(GraphQLTestCase):
8
8
GRAPHQL_URL = 'http://localhost/graphql'
9
9
def setUp (self ):
10
10
super ().setUp ()
11
- self .student1 = mixer .blend (Student , name = 'student1' )
12
- self .student2 = mixer .blend (Student , name = 'student2' )
11
+ self .student1 = mixer .blend (Student , name = 'student1' , roll_no = '1' , parentId = 'root' )
12
+ self .student2 = mixer .blend (Student , name = 'student2' , roll_no = '2' , parentId = '1' )
13
+ self .student3 = mixer .blend (Student , name = 'student3' , roll_no = '3' , parentId = '1' )
14
+ self .student4 = mixer .blend (Student , name = 'student4' , roll_no = '4' , parentId = '1' )
13
15
def test_student_query (self ):
14
16
response = self .query ('''
15
17
query {
@@ -22,4 +24,17 @@ def test_student_query(self):
22
24
content = json .loads (response .content )
23
25
self .assertResponseNoErrors (response )
24
26
self .assertDictEqual (content ['data' ]['students' ][0 ], {'id' : str (self .student1 .id ), 'name' : self .student1 .name })
25
- self .assertDictEqual (content ['data' ]['students' ][1 ], {'id' : str (self .student2 .id ), 'name' : self .student2 .name })
27
+ self .assertDictEqual (content ['data' ]['students' ][1 ], {'id' : str (self .student2 .id ), 'name' : self .student2 .name })
28
+ def test_student_sibling (self ):
29
+ response = self .query ('''
30
+ query {
31
+ studentSibling(roll: "2") {
32
+ id
33
+ name
34
+ }
35
+ }
36
+ ''' )
37
+ content = json .loads (response .content )
38
+ self .assertResponseNoErrors (response )
39
+ self .assertDictEqual (content ['data' ]['studentSibling' ][0 ], {'id' : str (self .student3 .id ), 'name' : self .student3 .name })
40
+ self .assertDictEqual (content ['data' ]['studentSibling' ][1 ], {'id' : str (self .student4 .id ), 'name' : self .student4 .name })
0 commit comments