|
7 | 7 |
|
8 | 8 | class StudentTestCases(GraphQLTestCase):
|
9 | 9 | GRAPHQL_URL = 'http://localhost/graphql'
|
| 10 | + |
10 | 11 | def setUp(self):
|
11 |
| - super().setUp() |
12 |
| - self.student1 = mixer.blend(Student, roll_no="B20AI014", parentId="B20AI100", name="Jaimin") |
13 |
| - self.student2 = mixer.blend(Student, roll_no="B20AI100") |
14 |
| - student2_roll_no = self.student2.roll_no |
| 12 | + super().setUp() |
| 13 | + self.student1 = mixer.blend(Student, name='student1', roll_no='1', parentId='root') |
| 14 | + self.student2 = mixer.blend(Student, name='student2', roll_no='2', parentId='1') |
| 15 | + self.student3 = mixer.blend(Student, name='student3', roll_no='3', parentId='1') |
| 16 | + self.student4 = mixer.blend(Student, name='student4', roll_no='4', parentId='1') |
15 | 17 |
|
16 | 18 | def test_children_query(self):
|
17 |
| - response = self.query( ''' |
| 19 | + response = self.query(''' |
18 | 20 | query {
|
19 |
| - children(parentId: "B20AI100"){ |
| 21 | + children(parentId: "1"){ |
20 | 22 | rollNo
|
21 | 23 | name
|
22 | 24 | }
|
23 | 25 | }
|
24 |
| - ''' ) |
25 |
| - |
| 26 | + ''') |
| 27 | + |
26 | 28 | content = json.loads(response.content)
|
27 | 29 | self.assertResponseNoErrors(response)
|
28 |
| - self.assertDictEqual(content['data']['children'][0], {'rollNo': 'B20AI014', 'name': 'Jaimin'}) |
| 30 | + self.assertDictEqual(content['data']['children'][0], {'rollNo': '2', 'name': 'student2'}) |
| 31 | + self.assertDictEqual(content['data']['children'][1], {'rollNo': '3', 'name': 'student3'}) |
| 32 | + self.assertDictEqual(content['data']['children'][2], {'rollNo': '4', 'name': 'student4'}) |
0 commit comments