def test_delete_contact(connection):
    contact = Contact(
        email='*****@*****.**'
    )
    contact.create()
    contact.delete()

    contact.create()
    Contact.delete(contact.id)
Beispiel #2
0
def sample_contact(request, connection, sample_contact_data):
    contact = Contact(**sample_contact_data)
    contact.create()

    def _finalizer():
        manually_delete_contact(connection, contact)

    request.addfinalizer(_finalizer)

    return contact
def test_create_valid_contact(connection, test_data):
    """
    Test that creating a contact creates and updates the ID value of
    the contact object correctly.
    
    :param connection: 
    :param test_data: 
    :return: 
    """
    contact = Contact(**test_data)
    assert contact.id is None
    contact.create()
    assert contact.id is not None
    for key, value in test_data.items():
        assert getattr(contact, key) == value
Beispiel #4
0
def test_create_valid_contact(request, connection, test_data):
    """
    Test that creating a contact creates and updates the ID value of
    the contact object correctly.

    :param connection:
    :param test_data:
    :return:
    """
    contact = Contact(**test_data)
    assert contact.id is None
    contact.create()
    # This way even if the test fails the test should clean up anything it
    # created for us
    def cleanup():
        manually_delete_contact(connection, contact)
    request.addfinalizer(cleanup)

    assert contact.id is not None
    for key, value in test_data.items():
        assert getattr(contact, key) == value
Beispiel #5
0
def sample_contact(sample_contact_data):
    sample_contact = Contact(**sample_contact_data)
    sample_contact.create()
    return sample_contact
Beispiel #6
0
def test_create_invalid_contact(connection, test_data):
    with pytest.raises(KeyError):
        contact = Contact(**test_data)
        contact.create()