add test crerate with amount laptops
This commit is contained in:
parent
3e2ed58b07
commit
a4aced0238
|
@ -599,6 +599,39 @@ def test_add_laptop(user3: UserClientFlask):
|
||||||
assert dev.hid == '1'
|
assert dev.hid == '1'
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.mvp
|
||||||
|
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||||
|
def test_add_with_ammount_laptops(user3: UserClientFlask):
|
||||||
|
uri = '/inventory/device/add/'
|
||||||
|
body, status = user3.get(uri)
|
||||||
|
assert status == '200 OK'
|
||||||
|
assert "New Device" in body
|
||||||
|
|
||||||
|
num = 3
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'csrf_token': generate_csrf(),
|
||||||
|
'type': "Laptop",
|
||||||
|
'amount': num,
|
||||||
|
'serial_number': "AAAAB",
|
||||||
|
'model': "LC27T55",
|
||||||
|
'manufacturer': "Samsung",
|
||||||
|
'generation': 1,
|
||||||
|
'weight': 0.1,
|
||||||
|
'height': 0.1,
|
||||||
|
'depth': 0.1,
|
||||||
|
'id_device_supplier': "b2",
|
||||||
|
}
|
||||||
|
body, status = user3.post(uri, data=data)
|
||||||
|
assert status == '200 OK'
|
||||||
|
assert 'Device "Laptop" created successfully!' in body
|
||||||
|
for dev in Device.query.all():
|
||||||
|
assert dev.type == 'Laptop'
|
||||||
|
assert dev.placeholder.id_device_supplier == "b2"
|
||||||
|
assert dev.hid in [str(x) for x in range(1, num+1)]
|
||||||
|
assert Device.query.count() == num
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||||
def test_add_laptop_duplicate(user3: UserClientFlask):
|
def test_add_laptop_duplicate(user3: UserClientFlask):
|
||||||
|
|
Reference in New Issue