From d8e33e680d6b74a1918923611f9695c1fcbf63fb Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 22 Sep 2022 13:16:14 +0200 Subject: [PATCH] changes messages for device add form --- ereuse_devicehub/inventory/forms.py | 6 +++--- tests/test_render_2_0.py | 11 ++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ereuse_devicehub/inventory/forms.py b/ereuse_devicehub/inventory/forms.py index f8ad673f..641d4b84 100644 --- a/ereuse_devicehub/inventory/forms.py +++ b/ereuse_devicehub/inventory/forms.py @@ -481,7 +481,7 @@ class NewDeviceForm(FlaskForm): Placeholder.phid == self.phid.data, Placeholder.owner == g.user ).first() if dev: - msg = "Sorry, exist one snapshot device with this HID" + msg = "Error, exist one Placeholder device with this PHID" self.phid.errors = [msg] is_valid = False @@ -494,7 +494,7 @@ class NewDeviceForm(FlaskForm): Placeholder.phid == self.phid.data, Device.owner == g.user ).first() if dev: - msg = "Sorry, exist one snapshot device with this HID" + msg = "Error, exist one Placeholder device with this PHID" self.phid.errors = [msg] is_valid = False @@ -908,7 +908,7 @@ class AllocateForm(ActionFormMixin): return True def check_deallocate(self): - txt = "Sorry some of this devices are actually deallocate" + txt = "Error, some of this devices are actually deallocate" for device in self._devices: allocates = [ ac for ac in device.actions if ac.type in ['Allocate', 'Deallocate'] diff --git a/tests/test_render_2_0.py b/tests/test_render_2_0.py index 2a426df7..a088df5a 100644 --- a/tests/test_render_2_0.py +++ b/tests/test_render_2_0.py @@ -268,7 +268,6 @@ def test_export_devices(user3: UserClientFlask): fixture_csv[1][:29] == export_csv[1][:29] ), 'Computer information are not equal' assert fixture_csv[1][30] == export_csv[1][30], 'Computer information are not equal' - # import pdb; pdb.set_trace() assert ( fixture_csv[1][32:93] == export_csv[1][32:93] ), 'Computer information are not equal' @@ -577,7 +576,7 @@ def test_update_monitor(user3: UserClientFlask): } body, status = user3.post(uri, data=data) assert status == '200 OK' - assert 'Sorry, exist one snapshot device with this HID' in body + assert 'Error, exist one Placeholder device with this PHID' in body dev = Device.query.one() assert dev.type == 'Monitor' assert dev.placeholder.id_device_supplier == "b2" @@ -764,7 +763,7 @@ def test_add_laptop_duplicate(user3: UserClientFlask): assert status == '200 OK' assert Device.query.count() == 1 body, status = user3.post(uri, data=data) - assert 'Sorry, exist one snapshot device with this HID' in body + assert 'Error, exist one Placeholder device with this PHID' in body assert Device.query.count() == 1 @@ -1109,7 +1108,7 @@ def test_action_deallocate_error(user3: UserClientFlask): assert status == '200 OK' assert dev.binding.device.allocated_status.type != 'Deallocate' assert 'Action Deallocate error!' in body - assert 'Sorry some of this devices are actually deallocate' in body + assert 'Error, some of this devices are actually deallocate' in body @pytest.mark.mvp @@ -1163,9 +1162,7 @@ def test_action_allocate_deallocate_error(user3: UserClientFlask): user3.post(uri, data=data) assert dev.binding.device.allocated_status.type == 'Deallocate' - # assert 'Action Deallocate error!' in body - # assert 'Sorry some of this devices are actually deallocate' in body - # + data = { 'csrf_token': generate_csrf(), 'type': "Deallocate",