Esempio n. 1
0
def test_should_map_only_few_fields():
    class Reporter2(DjangoObjectType):
        class Meta:
            model = Reporter
            only_fields = ('id', 'email')

    assert_equal_lists(Reporter2._meta.fields_map.keys(), ['id', 'email'])
Esempio n. 2
0
def test_should_map_only_few_fields():
    class Reporter2(SQLAlchemyObjectType):
        class Meta:
            model = Reporter
            only_fields = ("id", "email")

    assert_equal_lists(Reporter2._meta.fields_map.keys(), ["id", "email"])
Esempio n. 3
0
def test_object_type():
    object_type = schema.T(Human)
    Human._meta.fields_map
    assert Human._meta.interface is False
    assert isinstance(object_type, GraphQLObjectType)
    assert_equal_lists(object_type.get_fields().keys(), ["headline", "id", "reporter", "pubDate"])
    assert schema.T(DjangoNode) in object_type.get_interfaces()
Esempio n. 4
0
def test_objecttype_registered():
    object_type = schema.T(Character)
    assert isinstance(object_type, GraphQLObjectType)
    assert Character._meta.model == Reporter
    assert_equal_lists(
        object_type.get_fields().keys(),
        ['articles', 'firstName', 'lastName', 'email', 'id']
    )
Esempio n. 5
0
def test_objecttype_registered():
    object_type = schema.T(Character)
    assert isinstance(object_type, GraphQLObjectType)
    assert Character._meta.model == Reporter
    assert_equal_lists(
        object_type.get_fields().keys(),
        ['articles', 'firstName', 'lastName', 'email', 'id']
    )
Esempio n. 6
0
def test_pseudo_interface_registered():
    object_type = schema.T(Character)
    assert Character._meta.is_interface is True
    assert isinstance(object_type, GraphQLInterfaceType)
    assert Character._meta.model == Reporter
    assert_equal_lists(
        object_type.get_fields().keys(),
        ['articles', 'firstName', 'lastName', 'email', 'pets', 'id'])
Esempio n. 7
0
def test_object_type():
    object_type = schema.T(Human)
    Human._meta.fields_map
    assert Human._meta.is_interface is False
    assert isinstance(object_type, GraphQLObjectType)
    assert_equal_lists(object_type.get_fields().keys(),
                       ['headline', 'id', 'reporter', 'pubDate'])
    assert schema.T(DjangoNode) in object_type.get_interfaces()
Esempio n. 8
0
def test_should_map_fields_correctly():
    class ReporterType2(DjangoObjectType):
        class Meta:
            model = Reporter

    assert_equal_lists(ReporterType2._meta.fields_map.keys(), [
        'articles', 'first_name', 'last_name', 'email', 'pets', 'id', 'films'
    ])
Esempio n. 9
0
def test_should_map_fields_correctly():
    class ReporterType2(SQLAlchemyObjectType):
        class Meta:
            model = Reporter

    assert_equal_lists(
        ReporterType2._meta.fields_map.keys(), ["articles", "first_name", "last_name", "email", "pets", "id"]
    )
Esempio n. 10
0
def test_should_map_fields_correctly():
    class ReporterType2(DjangoObjectType):

        class Meta:
            model = Reporter
    assert_equal_lists(
        ReporterType2._meta.fields_map.keys(),
        ['articles', 'first_name', 'last_name', 'email', 'pets', 'id']
    )
Esempio n. 11
0
def test_pseudo_interface_registered():
    object_type = schema.T(Character)
    assert Character._meta.is_interface is True
    assert isinstance(object_type, GraphQLInterfaceType)
    assert Character._meta.model == Reporter
    assert_equal_lists(
        object_type.get_fields().keys(),
        ['articles', 'firstName', 'lastName', 'email', 'pets', 'id']
    )
Esempio n. 12
0
def test_should_map_only_few_fields():
    class Reporter2(DjangoObjectType):

        class Meta:
            model = Reporter
            only_fields = ('id', 'email')
    assert_equal_lists(
        Reporter2._meta.fields_map.keys(),
        ['id', 'email']
    )
Esempio n. 13
0
def test_object_type():
    object_type = schema.T(Human)
    Human._meta.fields_map
    assert Human._meta.interface is False
    assert isinstance(object_type, GraphQLObjectType)
    assert_equal_lists(
        object_type.get_fields().keys(),
        ['headline', 'id', 'reporter', 'reporterId', 'pubDate']
    )
    assert schema.T(SQLAlchemyNode) in object_type.get_interfaces()
Esempio n. 14
0
def test_object_type():
    object_type = schema.T(Human)
    Human._meta.fields_map
    assert Human._meta.is_interface is False
    assert isinstance(object_type, GraphQLObjectType)
    assert_equal_lists(
        object_type.get_fields().keys(),
        ['headline', 'id', 'reporter', 'pubDate']
    )
    # assert object_type.get_fields() == {
    #     'headline': fields_map['headline'].internal_field(schema),
    #     'id': fields_map['id'].internal_field(schema),
    #     'reporter': fields_map['reporter'].internal_field(schema),
    #     'pubDate': fields_map['pub_date'].internal_field(schema),
    # }
    assert schema.T(DjangoNode) in object_type.get_interfaces()
Esempio n. 15
0
def test_schema_get_type_map():
    assert_equal_lists(
        schema.schema.get_type_map().keys(),
        [
            "__Field",
            "String",
            "Pet",
            "Character",
            "__InputValue",
            "__Directive",
            "__TypeKind",
            "__Schema",
            "__Type",
            "Human",
            "__EnumValue",
            "Boolean",
        ],
    )
Esempio n. 16
0
def test_schema_get_type_map():
    assert_equal_lists(schema.schema.get_type_map().keys(), [
        '__Field', 'String', 'Pet', 'Character', '__InputValue', '__Directive',
        '__DirectiveLocation', '__TypeKind', '__Schema', '__Type', 'Human',
        '__EnumValue', 'Boolean'
    ])
Esempio n. 17
0
def test_schema_get_type_map():
    assert_equal_lists(
        schema.schema.get_type_map().keys(),
        ['__Field', 'String', 'Pet', 'Character', '__InputValue',
         '__Directive', '__TypeKind', '__Schema', '__Type', 'Human',
         '__EnumValue', 'Boolean'])