示例#1
0
def test_resource_update_should_refresh_if_target_is_becomming_source():
    municipality = factories.MunicipalityFactory(insee="12345")
    municipality.insee = '54321'
    municipality.increment_version()
    municipality.save()
    assert IdentifierRedirect.select().count() == 1
    municipality.insee = '12321'
    municipality.increment_version()
    municipality.save()
    assert IdentifierRedirect.select().count() == 2
    assert IdentifierRedirect.follow(models.Municipality, 'insee', '54321') == '12321'  # noqa
    assert IdentifierRedirect.follow(models.Municipality, 'insee', '12345') == '12321'  # noqa
示例#2
0
def test_follow_returns_new_value():
    municipality = factories.MunicipalityFactory(insee="12345")
    municipality.insee = '54321'
    municipality.increment_version()
    municipality.save()
    assert IdentifierRedirect.select().count() == 1
    assert IdentifierRedirect.follow(models.Municipality, 'insee', '12345') == '54321'  # noqa