예제 #1
0
def test_list_active_customers(_list_active_customers):
    """ actives """
    for customer in _list_active_customers:
        l.add_customer(customer[0], customer[1], customer[2], customer[3],
                       customer[4], customer[5], customer[6], customer[7])
    actives = l.list_active_customers()

    assert actives == 5

    for customer in _list_active_customers:
        l.delete_customer(customer[0])
예제 #2
0
def test_add_customer(_add_customers):
    """ additions """
    for customer in _add_customers:
        l.add_customer(customer[0], customer[1], customer[2], customer[3],
                       customer[4], customer[5], customer[6], customer[7])
        added = l.search_customer(customer[0])
        assert added["name"] == customer[1]
        assert added["lastname"] == customer[2]
        assert added["email"] == customer[5]
        assert added["phone_number"] == customer[4]

    for customer in _add_customers:
        l.delete_customer(customer[0])
예제 #3
0
def test_search_customer(_search_customers):
    """ search """
    for customer in _search_customers[0]:
        l.add_customer(customer[0], customer[1], customer[2], customer[3],
                       customer[4], customer[5], customer[6], customer[7])

    result = l.search_customer(_search_customers[1][1])
    assert result == {}

    result = l.search_customer(_search_customers[1][0])
    assert result["name"] == _search_customers[0][1][1]
    assert result["lastname"] == _search_customers[0][1][2]
    assert result["email"] == _search_customers[0][1][5]
    assert result["phone_number"] == _search_customers[0][1][4]

    for customer in _search_customers:
        l.delete_customer(customer[0])
예제 #4
0
def test_delete_customer(_delete_customers):
    """ delete """
    for customer in _delete_customers:
        l.add_customer(customer[0], customer[1], customer[2], customer[3],
                       customer[4], customer[5], customer[6], customer[7])

        response = l.delete_customer(customer[0])
        assert response is None

        deleted = l.search_customer(customer[0])
        assert deleted == {}