def test_system_add_post_workflows(self):
        """test add view"""

        # add app to dfirtrack.settings
        if 'dfirtrack_config' not in installed_apps:
            installed_apps.append('dfirtrack_config')
        # login testuser
        self.client.login(username='******',
                          password='******')
        # get object
        systemstatus_id = Systemstatus.objects.get(
            systemstatus_name='systemstatus_1').systemstatus_id
        workflow_id = Workflow.objects.get(
            workflow_name='workflow_1').workflow_id
        # create post data
        data_dict = {
            'system_name': 'system_add_with_valid_workflow',
            'systemstatus': systemstatus_id,
            'workflow': workflow_id,
            'iplist': '127.0.0.1',
        }
        # get response
        response = self.client.post('/system/add/', data_dict, follow=True)
        # compare
        self.assertContains(response, 'Workflow applied')
    def test_system_add_context_workflows(self):
        """test add view"""

        # add app to dfirtrack.settings
        if 'dfirtrack_config' not in installed_apps:
            installed_apps.append('dfirtrack_config')
        # login testuser
        self.client.login(username='******',
                          password='******')
        # get response
        response = self.client.get('/system/add/')
        # compare
        self.assertEqual(str(response.context['workflows'][0]), 'workflow_1')
    def test_system_list_context_with_api(self):
        """test list view"""

        # add app to dfirtrack.settings
        if 'dfirtrack_api' not in installed_apps:
            installed_apps.append('dfirtrack_api')
        # login testuser
        self.client.login(username='******',
                          password='******')
        # get response
        response = self.client.get('/system/')
        # compare
        self.assertTrue(response.context['dfirtrack_api'])
Exemple #4
0
    def test_case_detail_context_with_artifacts(self):
        """test detail view"""

        # add app to dfirtrack.settings
        if 'dfirtrack_artifacts' not in installed_apps:
            installed_apps.append('dfirtrack_artifacts')
        # get object
        case_1 = Case.objects.get(case_name='case_1')
        # login testuser
        self.client.login(username='******', password='******')
        # get response
        response = self.client.get('/case/' + str(case_1.case_id) + '/')
        # compare
        self.assertTrue(response.context['dfirtrack_artifacts'])
    def test_system_detail_context_with_api(self):
        """test detail view"""

        # add app to dfirtrack.settings
        if 'dfirtrack_api' not in installed_apps:
            installed_apps.append('dfirtrack_api')
        # get object
        system_1 = System.objects.get(system_name='system_1')
        # login testuser
        self.client.login(username='******',
                          password='******')
        # get response
        response = self.client.get('/system/' + str(system_1.system_id) + '/')
        # compare
        self.assertTrue(response.context['dfirtrack_api'])
    def test_system_detail_context_workflows(self):
        """test detail view"""

        # add app to dfirtrack.settings
        if 'dfirtrack_config' not in installed_apps:
            installed_apps.append('dfirtrack_config')
        # get object
        system_1 = System.objects.get(system_name='system_1')
        # login testuser
        self.client.login(username='******',
                          password='******')
        # get response
        response = self.client.get(f'/system/{system_1.system_id}/')
        # compare
        self.assertEqual(str(response.context['workflows'][0]), 'workflow_1')
    def test_system_detail_queryset_context_with_artifacts(self):
        """test detail view"""

        # add app to dfirtrack.settings
        if 'dfirtrack_artifacts' not in installed_apps:
            installed_apps.append('dfirtrack_artifacts')
        # get object
        system_1 = System.objects.get(system_name='system_1')
        # login testuser
        self.client.login(username='******',
                          password='******')
        # get queryset
        artifact_queryset = Artifact.objects.filter(system=system_1)
        # get response
        response = self.client.get('/system/' + str(system_1.system_id) + '/')
        # compare
        self.assertEqual(type(response.context['artifacts']),
                         type(artifact_queryset))