Ejemplo n.º 1
0
def test_duplicate_address_cannot_be_added(session, address_kw):
    with session.begin_nested():
        address = AddressFactory.create(**address_kw)

    new_addr = copy_factory(AddressFactory, address)
    with assert_unique_violation():
        with session.begin_nested():
            session.add(new_addr)
Ejemplo n.º 2
0
 def customize_address(self, user):
     self.user.address = address = AddressFactory.create(city="Bielefeld")
     session.session.add(user)
     session.session.commit()
     assert user.has_custom_address
     return address
Ejemplo n.º 3
0
 def create_factories(self):
     self.addr_everything = AddressFactory.create()
     self.addr_no_state = AddressFactory.create(state=None)
     self.addr_no_addition = AddressFactory.create(addition=None)
     self.addr_no_addition_and_state = AddressFactory.create(addition=None,
                                                             state=None)