Exemplo n.º 1
0
def test_create_invalid_address_book(test_data):
    """
    Test to confirm that when attempting to create an invalid address
    book, that an exception is raised.
     
    :param test_data: 
    :return: 
    """

    with pytest.raises((Exception, KeyError)):
        address_book = AddressBook(**test_data)
        address_book.create()
Exemplo n.º 2
0
def sample_address_book(request, connection, sample_address_book_data):
    address_book = AddressBook(**sample_address_book_data)
    address_book.create()

    # Adding a finalizer so that we can remove the address book so that
    # it would foul up other test cases or test runs.
    def _finalizer():
        manually_delete_address_book(connection, address_book)

    request.addfinalizer(_finalizer)

    return address_book
Exemplo n.º 3
0
def test_create_valid_address_book(connection, test_data):
    """
    Test to confirm that when submitting various different valid address
    books that they are created.
    
    :param connection: 
    :param test_data:
    :return: 
    """

    address_book = AddressBook(**test_data)
    address_book.create()
    assert address_book.id is not None

    # Attempt to delete the address book created by the test
    manually_delete_address_book(connection, address_book)
Exemplo n.º 4
0
def sample_address_book(connection, sample_address_book_data):
    sample_address_book = AddressBook(**sample_address_book_data)
    sample_address_book.create()
    return sample_address_book