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)
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
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)