def test_get_ubo(self): self.mock_ubo_creation() self.mock_get_ubo() ubo_declaration, user = self.legal_user_ubo_declaration params = { "user": user, "ubo_declaration": ubo_declaration, "first_name": "Victor", "last_name": "Hugo", "address": Address(address_line_1='AddressLine1', address_line_2='AddressLine2', city='City', region='Region', postal_code='11222', country='FR'), "birthday": 1231432, "nationality": "FR", "birthplace": Birthplace(city='Paris', country='FR') } existing_ubo = Ubo.create(**params) params = { "user_id": user.id, "ubo_declaration_id": ubo_declaration.id, "ubo_id": existing_ubo.get_pk() } fetched_ubo = Ubo.get("", **params) self.assertIsNotNone(fetched_ubo) self.assertEquals(existing_ubo.first_name, fetched_ubo.first_name) self.assertEquals(existing_ubo.last_name, fetched_ubo.last_name) self.assertEquals(existing_ubo.address, fetched_ubo.address) self.assertEquals(existing_ubo.nationality, fetched_ubo.nationality) self.assertEquals(existing_ubo.birthday, fetched_ubo.birthday) self.assertEquals(existing_ubo.birthplace, fetched_ubo.birthplace)
def test_update_ubo(self): self.mock_ubo_creation() self.mock_get_ubo() self.mock_update_ubo() ubo_declaration, user = self.legal_user_ubo_declaration params = { "user": user, "ubo_declaration": ubo_declaration, "first_name": "Victor", "last_name": "Hugo", "address": Address(address_line_1='AddressLine1', address_line_2='AddressLine2', city='City', region='Region', postal_code='11222', country='FR'), "birthday": 1231432, "nationality": "FR", "birthplace": Birthplace(city='Paris', country='FR') } to_be_updated = Ubo.create(**params) params_to_be_updated = { "user_id": user.get_pk(), "ubo_declaration_id": ubo_declaration.get_pk(), "first_name": "UpdatedFirstName", "last_name": "UpdatedLastName", "address": Address(address_line_1='UpdatedLine1'), "birthday": 25755342, "nationality": "GB", "birthplace": Birthplace(country='GB') } updated_ubo = to_be_updated.update(to_be_updated.get_pk(), **params_to_be_updated).execute() self.assertEquals(updated_ubo['first_name'], "UpdatedFirstName") self.assertEquals(updated_ubo['nationality'], "GB")
def test_create_ubo(self): self.mock_ubo_creation() ubo_declaration, user = self.legal_user_ubo_declaration ubo = self.ubo_declaration_ubo params = { "user": user, "ubo_declaration": ubo_declaration, "first_name": "Victor", "last_name": "Hugo", "address": Address(address_line_1='AddressLine1', address_line_2='AddressLine2', city='City', region='Region', postal_code='11222', country='FR'), "birthday": 1231432, "nationality": "FR", "birthplace": Birthplace(city='Paris', country='FR') } new_ubo = Ubo.create(**params) self.assertIsNotNone(new_ubo) self.assertIsNotNone(new_ubo.id) self.assertEquals(ubo.first_name, new_ubo.first_name) self.assertEquals(ubo.last_name, new_ubo.last_name) self.assertEquals(ubo.address, new_ubo.address) self.assertEquals(ubo.nationality, new_ubo.nationality) self.assertEquals(ubo.birthday, new_ubo.birthday) self.assertEquals(ubo.birthplace, new_ubo.birthplace)
def test_get_ubo(self): existing_ubo = self.get_ubo(True) user = self.get_user_legal() ubo_declaration = self.get_ubo_declaration() fetched_ubo = Ubo.get( existing_ubo.get_pk(), **{ 'user_id': user.id, 'ubo_declaration_id': ubo_declaration.id }) self.assertIsNotNone(fetched_ubo) self.assertEquals(existing_ubo.first_name, fetched_ubo.first_name) self.assertEquals(existing_ubo.last_name, fetched_ubo.last_name) self.assertEquals(existing_ubo.address, fetched_ubo.address) self.assertEquals(existing_ubo.nationality, fetched_ubo.nationality) self.assertEquals(existing_ubo.birthday, fetched_ubo.birthday) self.assertEquals(existing_ubo.birthplace, fetched_ubo.birthplace)
def get_ubo(recreate=False): if BaseTestLive._ubo is None or recreate: address = Address(address_line_1='AddressLine1', address_line_2='AddressLine2', city='City', region='Region', postal_code='11222', country='FR') params = { "user": BaseTestLive.get_user_legal(True), "ubo_declaration": BaseTestLive.get_ubo_declaration(True), "first_name": "Victor", "last_name": "Hugo", "address": address, "birthday": 1231432, "nationality": "FR", "birthplace": Birthplace(city='Paris', country='FR') } BaseTestLive._ubo = Ubo.create(**params) return BaseTestLive._ubo
def ubo_declaration_ubo(self): params = { "first_name": "Victor", "last_name": "Hugo", "address": Address(address_line_1='AddressLine1', address_line_2='AddressLine2', city='City', region='Region', postal_code='11222', country='FR'), "birthday": 1231432, "nationality": "FR", "birthplace": Birthplace(city='Paris', country='FR') } ubo = Ubo(**params) return ubo