Esempio n. 1
0
    def test_query(self, schema):

        query = schema.query[_.license(key='MIT')]
        assert query == quiz.Query(cls=schema.Query,
                                   selections=quiz.SelectionSet(
                                       quiz.Field('license',
                                                  {'key': 'MIT'}), ))
        with pytest.raises(quiz.SelectionError):
            schema.query[_.foo]
Esempio n. 2
0
    def test_gql(self):
        op = quiz.Query(Dog, quiz.SelectionSet(Field("name")))
        assert (quiz.gql(op) == dedent("""
        query {
          name
        }
        """).strip())

        assert quiz.gql(op) == str(op)
Esempio n. 3
0
    def test_gql(self):
        op = quiz.Query(Dog, quiz.SelectionSet(Field('name')))
        assert quiz.gql(op) == dedent('''
        query {
          name
        }
        ''').strip()

        assert quiz.gql(op) == str(op)
Esempio n. 4
0
    def test_query(self, schema):

        query = schema.query[_.license(key="MIT")]
        assert query == quiz.Query(
            cls=schema.Query,
            selections=quiz.SelectionSet(quiz.Field("license",
                                                    {"key": "MIT"})),
        )
        with pytest.raises(quiz.SelectionError):
            schema.query[_.foo]
Esempio n. 5
0
 def test_empty(self):
     selection = quiz.SelectionSet()
     loaded = quiz.load(DogQuery, selection, {})
     assert isinstance(loaded, DogQuery)