Skip to content

Commit 5d9b672

Browse files
committed
[fix] Fixed test_device_with_config_change_deactivate_deactivate
+ reformatted code
1 parent 32cd314 commit 5d9b672

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

openwisp_controller/config/tests/test_admin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2190,6 +2190,8 @@ def _get_delete_btn_html(self, device):
21902190
'Delete</a></p>'
21912191
)
21922192

2193+
_deactivated_device_expected_readonly_fields = 22
2194+
21932195
def test_device_with_config_change_deactivate_deactivate(self):
21942196
"""
21952197
This test checks the following things
@@ -2229,7 +2231,7 @@ def test_device_with_config_change_deactivate_deactivate(self):
22292231
self.assertContains(
22302232
response,
22312233
'<div class="readonly">',
2232-
22,
2234+
self._deactivated_device_expected_readonly_fields,
22332235
)
22342236
# Save buttons are absent on deactivated device
22352237
self.assertNotContains(response, self._save_btn_html)

tests/openwisp2/sample_config/tests.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
from openwisp_controller.config.tests.test_admin import TestAdmin as BaseTestAdmin
12
from openwisp_controller.config.tests.test_admin import (
2-
TestAdmin as BaseTestAdmin,
3-
TestTransactionAdmin as BaseTestTransactionAdmin,
3+
TestDeviceGroupAdmin as BaseTestDeviceGroupAdmin,
44
)
55
from openwisp_controller.config.tests.test_admin import (
6-
TestDeviceGroupAdmin as BaseTestDeviceGroupAdmin,
76
TestDeviceGroupAdminTransaction as BaseTestDeviceGroupAdminTransaction,
87
)
8+
from openwisp_controller.config.tests.test_admin import (
9+
TestTransactionAdmin as BaseTestTransactionAdmin,
10+
)
911
from openwisp_controller.config.tests.test_api import TestConfigApi as BaseTestConfigApi
1012
from openwisp_controller.config.tests.test_apps import TestApps as BaseTestApps
1113
from openwisp_controller.config.tests.test_config import TestConfig as BaseTestConfig
@@ -44,6 +46,7 @@ class TestAdmin(BaseTestAdmin):
4446

4547
class TestTransactionAdmin(BaseTestTransactionAdmin):
4648
app_label = 'sample_config'
49+
_deactivated_device_expected_readonly_fields = 23
4750

4851

4952
class TestDeviceGroupAdmin(BaseTestDeviceGroupAdmin):

0 commit comments

Comments
 (0)