Esempio n. 1
0
def test_add_contact(app, session):  # pylint:disable=unused-argument
    """Assert that a contact can be added to an Entity."""
    entity_info = {'businessIdentifier': 'CP1234567'}

    with app.app_context():
        entity = EntityService.create_entity(entity_info)
        contact_info = {'emailAddress': '*****@*****.**'}
        updated_entity = EntityService.add_contact(entity.business_identifier,
                                                   contact_info)

        assert updated_entity is not None

        contact = EntityService.get_contact_for_business(
            updated_entity.business_identifier)

        assert contact is not None
        assert contact.email == '*****@*****.**'
Esempio n. 2
0
def test_update_contact(app, session):  # pylint:disable=unused-argument
    """Assert that a contact for an entity can be updated."""
    entity_info = {'businessIdentifier': 'CP1234567'}

    with app.app_context():
        entity = EntityService.create_entity(entity_info)
        contact_info = {'emailAddress': '*****@*****.**'}
        EntityService.add_contact(entity.business_identifier, contact_info)

        contact_info['phoneNumber'] = '(555)-555-5555'
        updated_entity = EntityService.update_contact(
            entity.business_identifier, contact_info)

        assert updated_entity

        updated_contact = EntityService.get_contact_for_business(
            updated_entity.business_identifier)

        assert updated_contact is not None
        assert updated_contact.phone == '(555)-555-5555'