From cf7ada3d9ee050cb8681a98ef5807cb816d3cea1 Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Sat, 12 Sep 2020 10:08:47 +0100 Subject: [PATCH] Test fixes --- .../commands/generateSampleRIGSData.py | 2 +- RIGS/migrations/0055_auto_20200912_0903.py | 21 +++++++++++++++++++ RIGS/templatetags/filters.py | 12 ----------- RIGS/tests/test_functional.py | 1 - assets/tests/test_assets.py | 9 +------- 5 files changed, 23 insertions(+), 22 deletions(-) create mode 100644 RIGS/migrations/0055_auto_20200912_0903.py diff --git a/RIGS/management/commands/generateSampleRIGSData.py b/RIGS/management/commands/generateSampleRIGSData.py index 292395ac..2e37f9bc 100644 --- a/RIGS/management/commands/generateSampleRIGSData.py +++ b/RIGS/management/commands/generateSampleRIGSData.py @@ -174,7 +174,7 @@ class Command(BaseCommand): "add_person", "change_person", "view_person", "view_profile", "add_venue", "change_venue", "view_venue", "add_asset", "change_asset", "delete_asset", - "asset_finance", "view_asset", "view_supplier", "asset_finance", + "view_asset", "view_supplier", "asset_finance", "add_supplier", "view_cabletype", "change_cabletype", "add_cabletype", "view_eventchecklist", "change_eventchecklist", "add_eventchecklist", "view_riskassessment", "change_riskassessment", diff --git a/RIGS/migrations/0055_auto_20200912_0903.py b/RIGS/migrations/0055_auto_20200912_0903.py new file mode 100644 index 00000000..d1947e11 --- /dev/null +++ b/RIGS/migrations/0055_auto_20200912_0903.py @@ -0,0 +1,21 @@ +# Generated by Django 3.1 on 2020-09-12 08:03 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('RIGS', '0054_auto_20200831_1218'), + ] + + operations = [ + migrations.AlterModelOptions( + name='eventchecklist', + options={'ordering': ['event'], 'permissions': [('review_eventchecklist', 'Can review Event Checklists')]}, + ), + migrations.AlterModelOptions( + name='riskassessment', + options={'ordering': ['event'], 'permissions': [('review_riskassessment', 'Can review Risk Assessments')]}, + ), + ] diff --git a/RIGS/templatetags/filters.py b/RIGS/templatetags/filters.py index b47993ab..2ded1c56 100644 --- a/RIGS/templatetags/filters.py +++ b/RIGS/templatetags/filters.py @@ -152,18 +152,6 @@ def profile_by_index(value): return "" -@register.filter -def next(alist, current_index): - """ - Returns the next element of the list using the current index if it exists. - Otherwise returns an empty string. - """ - try: - return alist[int(current_index) + 1] # access the next element - except BaseException: - return '' # return empty string in case of exception - - @register.filter(needs_autoescape=True) def yesnoi(boolean, invert=False, autoescape=True): value = title(yesno(boolean)) diff --git a/RIGS/tests/test_functional.py b/RIGS/tests/test_functional.py index a54a0370..a9d6ec1c 100644 --- a/RIGS/tests/test_functional.py +++ b/RIGS/tests/test_functional.py @@ -716,7 +716,6 @@ class TestCalendar(BaseRigboardTest): # Wow - that was a lot of tests -@screenshot_failure_cls class ClientEventAuthorisationTest(TestCase): auth_data = { 'name': 'Test ABC', diff --git a/assets/tests/test_assets.py b/assets/tests/test_assets.py index c20c372f..c73286af 100644 --- a/assets/tests/test_assets.py +++ b/assets/tests/test_assets.py @@ -17,6 +17,7 @@ from PyRIGS.tests.base import animation_is_finished import datetime from django.utils import timezone from selenium.webdriver.common.action_chains import ActionChains +from django.test import tag @screenshot_failure_cls @@ -346,7 +347,6 @@ class TestAssetAudit(AutoLoginTest): self.assertIn("Asset with that ID does not exist!", self.page.error.text) -@screenshot_failure_cls class TestSupplierValidation(TestCase): @classmethod def setUpTestData(cls): @@ -369,7 +369,6 @@ class TestSupplierValidation(TestCase): self.assertFormError(response, 'form', 'name', 'This field is required.') -@screenshot_failure_cls class Test404(TestCase): @classmethod def setUpTestData(cls): @@ -388,8 +387,6 @@ class Test404(TestCase): self.assertEqual(response.status_code, 404) -# @tag('slow') TODO: req. Django 3.0 -@screenshot_failure_cls class TestAccessLevels(TestCase): @override_settings(DEBUG=True) def setUp(self): @@ -460,7 +457,6 @@ class TestAccessLevels(TestCase): # def test_finance_access(self): Level not used in assets currently -@screenshot_failure_cls class TestFormValidation(TestCase): @classmethod def setUpTestData(cls): @@ -529,7 +525,6 @@ class TestFormValidation(TestCase): self.assertFormError(response, 'form', 'csa', 'The CSA of a cable must be more than 0') -@screenshot_failure_cls class TestSampleDataGenerator(TestCase): @override_settings(DEBUG=True) def test_generate_sample_data(self): @@ -554,7 +549,6 @@ class TestSampleDataGenerator(TestCase): self.assertRaisesRegex(CommandError, ".*production", call_command, 'deleteSampleData') -@screenshot_failure_cls class TestVersioningViews(TestCase): @classmethod def setUpTestData(cls): @@ -598,7 +592,6 @@ class TestVersioningViews(TestCase): self.assertEqual(response.status_code, 200) -@screenshot_failure_cls class TestEmbeddedViews(TestCase): @classmethod def setUpTestData(cls):