def test_resource_update_should_propagate_if_target_is_becomming_source(): municipality = factories.MunicipalityFactory(insee="12345") municipality.insee = "54321" municipality.increment_version() municipality.save() assert Redirect.select().count() == 1 assert Redirect.follow("municipality", "insee", "12345") == [municipality.id] municipality2 = factories.MunicipalityFactory(insee="12321") # Should also update '12345' Redirect.add(municipality2, "insee", "54321") municipality.delete_instance() assert Redirect.select().count() == 2 assert Redirect.follow("municipality", "insee", "54321") == [municipality2.id] assert Redirect.follow("municipality", "insee", "12345") == [municipality2.id]
def test_cannot_duplicate_redirection(): position = factories.PositionFactory() Redirect.add(position, 'pk', '939') assert Redirect.select().count() == 1 Redirect.add(position, 'pk', '939') assert Redirect.select().count() == 1 assert Redirect.follow('Position', 'pk', '939') == [position.id]
def test_follow_returns_new_value(): municipality = factories.MunicipalityFactory(insee="12345") municipality.insee = "54321" municipality.increment_version() municipality.save() assert Redirect.select().count() == 1 assert Redirect.follow("municipality", "insee", "12345") == [municipality.id]
def test_cannot_duplicate_redirection(): position = factories.PositionFactory() Redirect.add(position, "pk", "939") assert Redirect.select().count() == 1 Redirect.add(position, "pk", "939") assert Redirect.select().count() == 1 assert Redirect.follow("Position", "pk", "939") == [position.id]
def test_resource_update_should_propagate_if_target_is_becomming_source(): municipality = factories.MunicipalityFactory(insee='12345') municipality.insee = '54321' municipality.increment_version() municipality.save() assert Redirect.select().count() == 1 assert Redirect.follow('municipality', 'insee', '12345') == [ municipality.id] municipality2 = factories.MunicipalityFactory(insee='12321') # Should also update '12345' Redirect.add(municipality2, 'insee', '54321') municipality.delete_instance() assert Redirect.select().count() == 2 assert Redirect.follow('municipality', 'insee', '54321') == [ municipality2.id] assert Redirect.follow('municipality', 'insee', '12345') == [ municipality2.id]
def test_follow_returns_new_value(): municipality = factories.MunicipalityFactory(insee="12345") municipality.insee = '54321' municipality.increment_version() municipality.save() assert Redirect.select().count() == 1 assert Redirect.follow('municipality', 'insee', '12345') == [ municipality.id]
def test_can_create_multiple_redirections(): position1 = factories.PositionFactory() position2 = factories.PositionFactory() Redirect.add(position1, 'pk', '939') assert Redirect.select().count() == 1 Redirect.add(position2, 'pk', '939') assert Redirect.select().count() == 2 redirects = Redirect.follow('Position', 'pk', '939') assert position1.id in redirects assert position2.id in redirects
def test_can_create_multiple_redirections(): position1 = factories.PositionFactory() position2 = factories.PositionFactory() Redirect.add(position1, "pk", "939") assert Redirect.select().count() == 1 Redirect.add(position2, "pk", "939") assert Redirect.select().count() == 2 redirects = Redirect.follow("Position", "pk", "939") assert position1.id in redirects assert position2.id in redirects
def test_can_point_from_an_identifier_to_another(): municipality = factories.MunicipalityFactory() Redirect.add(municipality, 'insee', '12345') assert Redirect.select().count() == 1 assert Redirect.follow('municipality', 'insee', '12345') == [ municipality.id]
def test_can_point_from_an_identifier_to_another(): municipality = factories.MunicipalityFactory() Redirect.add(municipality, "insee", "12345") assert Redirect.select().count() == 1 assert Redirect.follow("municipality", "insee", "12345") == [municipality.id]