def test_build_types_reference(self): res = build_types_reference(schema.graphql_schema) self.assertEqual(len(res.scalars), 2) self.assertEqual(len(res.enums), 1) self.assertEqual(res.enums[0].name, 'Options') self.assertTrue(isinstance(res.enums[0].values, dict)) self.assertIn('ONE', res.enums[0].values) self.assertIn('TWO', res.enums[0].values) self.assertTrue(isinstance(res.query.fields, dict)) self.assertIn('allData', res.query.fields)
def test_finds_scalars(self): ref = build_types_reference(SCHEMA) self.assertEqual(7, len(ref.scalars))
def test_finds_input_objects(self): ref = build_types_reference(SCHEMA) self.assertEqual(1, len(ref.input_objects))
def test_finds_unions(self): ref = build_types_reference(SCHEMA) self.assertEqual(1, len(ref.unions))
def test_finds_interfaces(self): ref = build_types_reference(SCHEMA) self.assertEqual(1, len(ref.interfaces))
def test_finds_enums(self): ref = build_types_reference(SCHEMA) self.assertEqual(1, len(ref.enums))
def test_finds_objects_without_query_nor_mutation(self): ref = build_types_reference(SCHEMA) self.assertEqual(53, len(ref.objects))
def test_finds_query(self): ref = build_types_reference(SCHEMA) self.assertNotEqual(None, ref.query) self.assertEqual('Root', ref.query.name)