Пример #1
0
    def test_system_settings_update(self):
        try:
            # although the unittests are run after initial data has been loaded, for some reason in cicd sometimes the settings aren't present
            system_settings = System_Settings.objects.get()
        except System_Settings.DoesNotExist:
            system_settings = System_Settings()

        system_settings.enable_jira = True
        system_settings.save()
        system_settings = System_Settings.objects.get()
        self.assertEquals(system_settings.enable_jira, True)

        system_settings.enable_jira = False
        system_settings.save()
        system_settings = System_Settings.objects.get()
        self.assertEquals(system_settings.enable_jira, False)

        system_settings.enable_jira = True
        system_settings.save()
        system_settings = System_Settings.objects.get(no_cache=True)
        self.assertEquals(system_settings.enable_jira, True)

        system_settings.enable_google_sheets = True
        system_settings.save()
        system_settings = System_Settings.objects.get(no_cache=True)
        self.assertEquals(system_settings.enable_google_sheets, True)
Пример #2
0
    def create():
        settings = System_Settings()
        settings.save()

        p = Product()
        p.Name = 'Test Product'
        p.Description = 'Product for Testing Apply Template functionality'
        p.prod_type = Product_Type.objects.get(id=1)
        p.save()

        e = Engagement()
        e.product = p
        e.target_start = timezone.now()
        e.target_end = e.target_start + datetime.timedelta(days=5)
        e.save()

        tt = Test_Type()
        tt.name = 'Temporary Test'
        tt.save()

        t = Test()
        t.engagement = e
        t.test_type = tt
        t.target_start = timezone.now()
        t.target_end = t.target_start + datetime.timedelta(days=5)
        t.save()

        user = FindingTemplateTestUtil.create_user(True)

        f = Finding()
        f.title = 'Finding for Testing Apply Template functionality'
        f.severity = 'High'
        f.description = 'Finding for Testing Apply Template Functionality'
        f.test = t
        f.reporter = user
        f.last_reviewed = timezone.now()
        f.last_reviewed_by = user
        f.save()
    def create():
        settings = System_Settings()
        settings.save()

        p = Product()
        p.Name = 'Test Product'
        p.Description = 'Product for Testing Apply Template functionality'
        p.save()

        e = Engagement()
        e.product = p
        e.target_start = timezone.now()
        e.target_end = e.target_start + datetime.timedelta(days=5)
        e.save()

        tt = Test_Type()
        tt.name = 'Temporary Test'
        tt.save()

        t = Test()
        t.engagement = e
        t.test_type = tt
        t.target_start = timezone.now()
        t.target_end = t.target_start + datetime.timedelta(days=5)
        t.save()

        user = FindingTemplateTestUtil.create_user(True)

        f = Finding()
        f.title = 'Finding for Testing Apply Template functionality'
        f.severity = 'High'
        f.description = 'Finding for Testing Apply Template Functionality'
        f.test = t
        f.reporter = user
        f.last_reviewed = timezone.now()
        f.last_reviewed_by = user
        f.save()