def test_as_dict(session): # pylint:disable=unused-argument """Assert that the Entity is exported correctly as a dictionary.""" entity_model = factory_entity_model() entity = EntityService(entity_model) dictionary = entity.as_dict() assert dictionary['business_identifier'] == TestEntityInfo.entity1['businessIdentifier']
def test_update_contact(session): # pylint:disable=unused-argument """Assert that a contact for an existing Entity can be updated.""" entity_model = factory_entity_model() entity = EntityService(entity_model) entity.add_contact(TestContactInfo.contact1) dictionary = entity.as_dict() assert len(dictionary['contacts']) == 1 assert dictionary['contacts'][0]['email'] == TestContactInfo.contact1['email'] entity.update_contact(TestContactInfo.contact2) dictionary = None dictionary = entity.as_dict() assert len(dictionary['contacts']) == 1 assert dictionary['contacts'][0]['email'] == TestContactInfo.contact2['email']
def test_as_dict(): """Assert that the Entity is exported correctly as a dictionary.""" entity_model = EntityModel(business_identifier='CP1234567') entity = EntityService(entity_model) assert entity.as_dict() == { 'businessIdentifier': 'CP1234567' }
def test_entity_name_sync(app, session): # pylint:disable=unused-argument """Assert that the name syncing for entity affiliation is working correctly.""" entity_model = factory_entity_model( entity_info=TestEntityInfo.entity_lear_mock) entity = EntityService(entity_model) entity.sync_name() dictionary = entity.as_dict() assert dictionary['name'] == 'Legal Name CP0002103'
def test_update_contact(session): # pylint:disable=unused-argument """Assert that a contact for an existing Entity can be updated.""" entity_model = factory_entity_model(business_identifier='CP1234567') entity = EntityService(entity_model) entity.add_contact(TEST_CONTACT_INFO) dictionary = entity.as_dict() assert len(dictionary['contacts']) == 1 assert dictionary['contacts'][0]['email'] == \ TEST_CONTACT_INFO['email'] entity.update_contact(TEST_UPDATED_CONTACT_INFO) dictionary = None dictionary = entity.as_dict() assert len(dictionary['contacts']) == 1 assert dictionary['contacts'][0]['email'] == \ TEST_UPDATED_CONTACT_INFO['email']
def test_add_contact(session): # pylint:disable=unused-argument """Assert that a contact can be added to an Entity.""" entity_model = factory_entity_model() entity = EntityService(entity_model) entity.add_contact(TestContactInfo.contact1) dictionary = entity.as_dict() assert dictionary['contacts'] assert len(dictionary['contacts']) == 1 assert dictionary['contacts'][0]['email'] == TestContactInfo.contact1['email']
def test_entity_find_by_entity_id(session, auth_mock): # pylint:disable=unused-argument """Assert that an Entity can be retrieved by entity identifier.""" entity_model = factory_entity_model() entity = EntityService(entity_model) entity = EntityService.find_by_entity_id(entity.identifier) assert entity is not None dictionary = entity.as_dict() assert dictionary['business_identifier'] == TestEntityInfo.entity1['businessIdentifier']
def test_add_contact(session): # pylint:disable=unused-argument """Assert that a contact can be added to an Entity.""" entity_model = factory_entity_model(business_identifier='CP1234567') entity = EntityService(entity_model) entity.add_contact(TEST_CONTACT_INFO) dictionary = entity.as_dict() assert dictionary['contacts'] assert len(dictionary['contacts']) == 1 assert dictionary['contacts'][0]['email'] == TEST_CONTACT_INFO['email']