Use Autocomplete instead of Select in Add to List screen
This commit is contained in:
@@ -13,6 +13,7 @@ from sigl.domain.service import (
|
||||
list_deleteCrossedOff,
|
||||
list_entry_set_crossedOff,
|
||||
product_by_id,
|
||||
product_create,
|
||||
)
|
||||
|
||||
# Always use 'app' fixture so ORM gets initialized
|
||||
@@ -45,6 +46,42 @@ def test_list_add_product_defaults(session):
|
||||
assert list.entries[0] == entry
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_list_add_product_by_id(session):
|
||||
"""Test adding an existing Product to a List by Id."""
|
||||
p1 = product_create(session, 'Eggs', category='Dairy')
|
||||
|
||||
list = list_create(session, 'Test')
|
||||
entry = list_addItem(session, list.id, productId=p1.id)
|
||||
|
||||
assert entry.id is not None
|
||||
assert entry.product is not None
|
||||
assert entry.product.name == 'Eggs'
|
||||
assert entry.product.category == 'Dairy'
|
||||
assert entry.product.remember is True
|
||||
|
||||
assert len(list.entries) == 1
|
||||
assert list.entries[0] == entry
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_list_add_product_by_name(session):
|
||||
"""Test adding an existing Product to a List by Name."""
|
||||
product_create(session, 'Eggs', category='Dairy')
|
||||
|
||||
list = list_create(session, 'Test')
|
||||
entry = list_addItem(session, list.id, productName='eggs')
|
||||
|
||||
assert entry.id is not None
|
||||
assert entry.product is not None
|
||||
assert entry.product.name == 'Eggs'
|
||||
assert entry.product.category == 'Dairy'
|
||||
assert entry.product.remember is True
|
||||
|
||||
assert len(list.entries) == 1
|
||||
assert list.entries[0] == entry
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_list_add_product_no_remember(session):
|
||||
"""Test adding a Product to a List without remembering it."""
|
||||
|
||||
Reference in New Issue
Block a user