Пример #1
0
 def test_inputfield_object_non_nullable(self):
     want = graphql.TypeRef(
         name="SetArmedStateForHomeInput",
         kind="INPUT_OBJECT",
         is_list=False,
         non_null_item=False,
         non_null=True,
     )
     got = oracle.get_typeref(
         "Expected type SetArmedStateForHomeInput!, found 7.", "InputValue")
     self.assertEqual(got, want)
Пример #2
0
 def test_skip_error_message(self):
     want = None
     with self.assertLogs() as cm:
         got = oracle.get_typeref(
             'Field "species" of type "Species" must have a selection of subfields. Did you mean "species { ... }"?',
             "InputValue",
         )
         # https://stackoverflow.com/a/61381576
         logging.warning("Dummy warning")
     self.assertEqual(want, got)
     self.assertCountEqual(["WARNING:root:Dummy warning"], cm.output)
Пример #3
0
 def test_field_regex_3(self):
     want = graphql.TypeRef(
         name="HomeSettings",
         kind="OBJECT",
         is_list=False,
         non_null_item=False,
         non_null=False,
     )
     got = oracle.get_typeref(
         'Cannot query field "imwrongfield" on type "HomeSettings".',
         "Field")
     self.assertEqual(got, want)
Пример #4
0
 def test_non_nullable_object(self):
     want = graphql.TypeRef(
         name="SetArmedStateForHomeInput",
         kind="INPUT_OBJECT",
         is_list=False,
         non_null_item=False,
         non_null=True,
     )
     got = oracle.get_typeref(
         'Field "setArmedStateForHome" argument "input" of type "SetArmedStateForHomeInput!" is required, but it was not provided.',
         "InputValue",
     )
     self.assertEqual(got, want)
Пример #5
0
 def test_via_wrong_field(self):
     want = graphql.TypeRef(
         name="Boolean",
         kind="SCALAR",
         is_list=False,
         non_null_item=False,
         non_null=True,
     )
     got = oracle.get_typeref(
         'Field "isMfaEnabled" must not have a selection since type "Boolean!" has no subfields.',
         "Field",
     )
     self.assertEqual(got, want)
Пример #6
0
 def test_object_field(self):
     want = graphql.TypeRef(
         name="SetArmedStateForHomePayload",
         kind="OBJECT",
         is_list=False,
         non_null_item=False,
         non_null=False,
     )
     got = oracle.get_typeref(
         'Field "setArmedStateForHome" of type "SetArmedStateForHomePayload" must have a selection of subfields. Did you mean "setArmedStateForHome { ... }"?',
         "Field",
     )
     self.assertEqual(got, want)
Пример #7
0
 def test_dvga(self):
     want = graphql.TypeRef(
         name="String",
         kind="SCALAR",
         is_list=False,
         non_null_item=False,
         non_null=False,
     )
     got = oracle.get_typeref(
         'Field "systemHealth" of type "String" must not have a sub selection.',
         "Field")
     self.assertEqual(got.name, want.name)
     self.assertEqual(got.kind, want.kind)
     self.assertEqual(got.is_list, want.is_list)
     self.assertEqual(got.non_null_item, want.non_null_item)
     self.assertEqual(got.non_null, want.non_null)
Пример #8
0
 def test_issue_16(self):
     want = graphql.TypeRef(
         name="ID",
         kind="SCALAR",
         is_list=False,
         non_null_item=False,
         non_null=True,
     )
     got = oracle.get_typeref(
         'Field "node" argument "id" of type "ID!" is required but not provided.',
         "InputValue")
     self.assertEqual(got.name, want.name)
     self.assertEqual(got.kind, want.kind)
     self.assertEqual(got.is_list, want.is_list)
     self.assertEqual(got.non_null_item, want.non_null_item)
     self.assertEqual(got.non_null, want.non_null)