Beispiel #1
0
def test_put_depmap_entity_after_required_fail(use_testdb):
    pd = PonyDump(testdb)

    with pytest.raises(ValueError) as excinfo:
        pd.put_depmap_entity_after('pdtest1', after_entity='pdtest2')

    assert str(
        excinfo.value) == 'Required dependencies does not allow this moving'

    assert pd.depmap == [
        ('many1', ({}, {}, {
            'many2': 'many2'
        })),
        ('many2', ({}, {}, {
            'many1': 'many1'
        })),
        ('pdtest1', ({}, {
            'test2': 'pdtest2',
            'test4': 'pdtest4'
        }, {
            'test3': 'pdtest3'
        })),
        ('pdtest3', ({}, {
            'test1': 'pdtest1'
        }, {})),
        ('pdtest4', ({}, {
            'test1': 'pdtest1'
        }, {})),
        ('pdtest2', ({
            'test1': 'pdtest1'
        }, {}, {})),
    ]
Beispiel #2
0
def test_put_depmap_entity_after_all_ok(use_testdb):
    pd = PonyDump(testdb)

    pd.put_depmap_entity_after('many1', after_entity=None)
    assert pd.depmap == [
        ('many2', ({}, {}, {
            'many1': 'many1'
        })),
        ('pdtest1', ({}, {
            'test2': 'pdtest2',
            'test4': 'pdtest4'
        }, {
            'test3': 'pdtest3'
        })),
        ('pdtest3', ({}, {
            'test1': 'pdtest1'
        }, {})),
        ('pdtest4', ({}, {
            'test1': 'pdtest1'
        }, {})),
        ('pdtest2', ({
            'test1': 'pdtest1'
        }, {}, {})),
        ('many1', ({}, {}, {
            'many2': 'many2'
        })),
    ]
def test_put_depmap_entity_after_all_ok(use_testdb):
    pd = PonyDump(testdb)

    pd.put_depmap_entity_after('many1', after_entity=None)
    assert pd.depmap == [
        ('many2', ({}, {}, {'many1': 'many1'})),
        ('pdtest1', ({}, {'test2': 'pdtest2', 'test4': 'pdtest4'}, {'test3': 'pdtest3'})),
        ('pdtest3', ({}, {'test1': 'pdtest1'}, {})),
        ('pdtest4', ({}, {'test1': 'pdtest1'}, {})),
        ('pdtest2', ({'test1': 'pdtest1'}, {}, {})),
        ('many1', ({}, {}, {'many2': 'many2'})),
    ]
def test_put_depmap_entity_after_required_fail(use_testdb):
    pd = PonyDump(testdb)

    with pytest.raises(ValueError) as excinfo:
        pd.put_depmap_entity_after('pdtest1', after_entity='pdtest2')

    assert str(excinfo.value) == 'Required dependencies does not allow this moving'

    assert pd.depmap == [
        ('many1', ({}, {}, {'many2': 'many2'})),
        ('many2', ({}, {}, {'many1': 'many1'})),
        ('pdtest1', ({}, {'test2': 'pdtest2', 'test4': 'pdtest4'}, {'test3': 'pdtest3'})),
        ('pdtest3', ({}, {'test1': 'pdtest1'}, {})),
        ('pdtest4', ({}, {'test1': 'pdtest1'}, {})),
        ('pdtest2', ({'test1': 'pdtest1'}, {}, {})),
    ]