def test_foreign_key_use_alter():

    con_type = 'foreign_keys'
    con_json = {'name': 'test_con', 'source_field': 'id',
                'target_table': 'foo', 'target_field': 'bar'}

    constraint = make_constraint(con_type, con_json)
    ok_(constraint.use_alter)
Exemplo n.º 2
0
def test_foreign_key_use_alter():

    con_type = 'foreign_keys'
    con_json = {
        'name': 'test_con',
        'source_field': 'id',
        'target_table': 'foo',
        'target_field': 'bar'
    }

    constraint = make_constraint(con_type, con_json)
    ok_(constraint.use_alter)
def test_types():

    for con_type, con_class in CONSTRAINT_MAP.iteritems():

        if con_type == 'foreign_keys':
            con_json = {'name': 'test_con', 'source_field': 'id',
                        'target_table': 'foo', 'target_field': 'bar'}
        else:
            con_json = {'name': 'test_con', 'fields': ['id']}

        constraint = make_constraint(con_type, con_json)
        assert isinstance(constraint, con_class)
Exemplo n.º 4
0
def test_types():

    for con_type, con_class in CONSTRAINT_MAP.iteritems():

        if con_type == 'foreign_keys':
            con_json = {
                'name': 'test_con',
                'source_field': 'id',
                'target_table': 'foo',
                'target_field': 'bar'
            }
        else:
            con_json = {'name': 'test_con', 'fields': ['id']}

        constraint = make_constraint(con_type, con_json)
        assert isinstance(constraint, con_class)
def test_fields():

    for con_type, con_class in CONSTRAINT_MAP.iteritems():

        if con_type == 'foreign_keys':
            con_json = {'name': 'test_con', 'source_field': 'id',
                        'target_table': 'foo', 'target_field': 'bar'}
        else:
            con_json = {'name': 'test_con', 'fields': ['id']}

        constraint = make_constraint(con_type, con_json)

        if con_type == 'foreign_keys':
            eq_(constraint.column_keys, ['id'])
            eq_(constraint.elements[0].target_fullname, 'foo.bar')
        else:
            eq_(constraint._pending_colargs, ['id'])
Exemplo n.º 6
0
def test_fields():

    for con_type, con_class in CONSTRAINT_MAP.iteritems():

        if con_type == 'foreign_keys':
            con_json = {
                'name': 'test_con',
                'source_field': 'id',
                'target_table': 'foo',
                'target_field': 'bar'
            }
        else:
            con_json = {'name': 'test_con', 'fields': ['id']}

        constraint = make_constraint(con_type, con_json)

        if con_type == 'foreign_keys':
            eq_(constraint.column_keys, ['id'])
            eq_(constraint.elements[0].target_fullname, 'foo.bar')
        else:
            eq_(constraint._pending_colargs, ['id'])