From a4aced0238a91a0fd43e2d64ad23fff96d4c777e Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 29 Jun 2022 13:46:19 +0200 Subject: [PATCH] add test crerate with amount laptops --- tests/test_render_2_0.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/test_render_2_0.py b/tests/test_render_2_0.py index 8e658cb7..fb613ee3 100644 --- a/tests/test_render_2_0.py +++ b/tests/test_render_2_0.py @@ -599,6 +599,39 @@ def test_add_laptop(user3: UserClientFlask): 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.usefixtures(conftest.app_context.__name__) def test_add_laptop_duplicate(user3: UserClientFlask):