Beispiel #1
0
def test_orders_by_customer_unshipped_only_details():
    expected_results = [
        ('wlk001', 'cookiemon', '111-111-1111', 'dark chocolate chip', 2, Decimal('1.00')),
        ('wlk001', 'cookiemon', '111-111-1111', 'oatmeal raisin', 12, Decimal('3.00'))
    ]
    results = get_orders_by_customer('cookiemon', shipped=False, details=True)
    assert results == expected_results
Beispiel #2
0
def test_orders_by_customer_shipped_only_with_details():
    results = get_orders_by_customer('cookiemon', True, True)
    assert results == []
Beispiel #3
0
def test_order_by_customer_shipped_only():
    results = get_orders_by_customer('cookiemon', True)
    assert results == []
Beispiel #4
0
def test_orders_by_customer_unshipped_only():
    expected_results = [('wlk001', 'cookiemon', '111-111-1111')]
    results = get_orders_by_customer('cookiemon', False)
    assert results == expected_results
Beispiel #5
0
def test_orders_by_blank_customer_name_not_shipped_details():
    results = get_orders_by_customer('', shipped=False, details=True)
    assert results == []
Beispiel #6
0
def test_orders_by_customer():
    expected_result = [('wlk001', 'cookiemon', '111-111-1111')]
    results = get_orders_by_customer('cookiemon')
    assert results == expected_result
Beispiel #7
0
def test_orders_by_blank_customer_name_details():
    results = get_orders_by_customer('', details=True)
    assert results == []
Beispiel #8
0
def test_orders_by_blank_customer_name_not_shipped():
    results = get_orders_by_customer('', shipped=False)
    assert results == []
Beispiel #9
0
def test_orders_by_blank_customer_name():
    results = get_orders_by_customer('')
    assert results == []
def test_orders_by_customer(mocker):
    mocker.patch.object(dal, 'connection')
    cookie_orders = [('wlk001', 'cookiemon', '111-111-1111')]
    dal.connection.execute.return_value.fetchall.return_value = cookie_orders
    assert get_orders_by_customer('cookiemon') == cookie_orders
def test_orders_by_customer_blank(mocker):
    mocker.patch.object(dal, 'connection')
    mocker.patch.object(app, 'select')
    dal.connection.execute.return_value.fetchall.return_value = []
    app.select.return_value.select_from.return_value.where.return_value = ''
    assert get_orders_by_customer('') == []