Ejemplo n.º 1
0
    def test_artifact_sha256_form_filled(self):
        """test additional form content"""

        # get object
        artifactpriority_id = Artifactpriority.objects.get(
            artifactpriority_name='artifactpriority_1').artifactpriority_id
        # get object
        artifactstatus_id = Artifactstatus.objects.get(
            artifactstatus_name='artifactstatus_1').artifactstatus_id
        # get object
        artifacttype_id = Artifacttype.objects.get(
            artifacttype_name='artifacttype_1').artifacttype_id
        # get object
        system_id = System.objects.get(system_name='system_1').system_id
        # get object
        form = ArtifactForm(
            data={
                'artifact_name':
                'artifact_1',
                'artifactpriority':
                artifactpriority_id,
                'artifactstatus':
                artifactstatus_id,
                'artifacttype':
                artifacttype_id,
                'system':
                system_id,
                'artifact_sha256':
                'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
            })
        # compare
        self.assertTrue(form.is_valid())
Ejemplo n.º 2
0
    def test_artifact_system_form_filled(self):
        """test minimum form requirements / VALID"""

        # get object
        artifactpriority_id = Artifactpriority.objects.get(
            artifactpriority_name='artifactpriority_1').artifactpriority_id
        # get object
        artifactstatus_id = Artifactstatus.objects.get(
            artifactstatus_name='artifactstatus_1').artifactstatus_id
        # get object
        artifacttype_id = Artifacttype.objects.get(
            artifacttype_name='artifacttype_1').artifacttype_id
        # get object
        system_id = System.objects.get(system_name='system_1').system_id
        # get object
        form = ArtifactForm(
            data={
                'artifact_name': 'artifact_1',
                'artifactpriority': artifactpriority_id,
                'artifactstatus': artifactstatus_id,
                'artifacttype': artifacttype_id,
                'system': system_id,
            })
        # compare
        self.assertTrue(form.is_valid())
Ejemplo n.º 3
0
    def test_artifact_note_internal_form_filled(self):
        """test additional form content"""

        # get object
        artifactpriority_id = Artifactpriority.objects.get(
            artifactpriority_name='artifactpriority_1').artifactpriority_id
        # get object
        artifactstatus_id = Artifactstatus.objects.get(
            artifactstatus_name='artifactstatus_1').artifactstatus_id
        # get object
        artifacttype_id = Artifacttype.objects.get(
            artifacttype_name='artifacttype_1').artifacttype_id
        # get object
        system_id = System.objects.get(system_name='system_1').system_id
        # get object
        form = ArtifactForm(
            data={
                'artifact_name':
                'artifact_1',
                'artifactpriority':
                artifactpriority_id,
                'artifactstatus':
                artifactstatus_id,
                'artifacttype':
                artifacttype_id,
                'system':
                system_id,
                'artifact_note_internal':
                'this is a note for internal usage - no export intended',
            })
        # compare
        self.assertTrue(form.is_valid())
Ejemplo n.º 4
0
    def test_artifact_sha1_proper_chars(self):
        """test for max length"""

        # get object
        artifactpriority_id = Artifactpriority.objects.get(
            artifactpriority_name='artifactpriority_1').artifactpriority_id
        # get object
        artifactstatus_id = Artifactstatus.objects.get(
            artifactstatus_name='artifactstatus_1').artifactstatus_id
        # get object
        artifacttype_id = Artifacttype.objects.get(
            artifacttype_name='artifacttype_1').artifacttype_id
        # get object
        system_id = System.objects.get(system_name='system_1').system_id
        # get object
        form = ArtifactForm(
            data={
                'artifact_name': 'artifact_1',
                'artifactpriority': artifactpriority_id,
                'artifactstatus': artifactstatus_id,
                'artifacttype': artifacttype_id,
                'system': system_id,
                'artifact_sha1': 'b' * 40,
            })
        # compare
        self.assertTrue(form.is_valid())
Ejemplo n.º 5
0
    def test_artifact_sha256_hexadecimal_chars(self):
        """test for hexadecimal characters"""

        # get object
        artifactpriority_id = Artifactpriority.objects.get(
            artifactpriority_name='artifactpriority_1').artifactpriority_id
        # get object
        artifactstatus_id = Artifactstatus.objects.get(
            artifactstatus_name='artifactstatus_1').artifactstatus_id
        # get object
        artifacttype_id = Artifacttype.objects.get(
            artifacttype_name='artifacttype_1').artifacttype_id
        # get object
        system_id = System.objects.get(system_name='system_1').system_id
        # get object
        form = ArtifactForm(
            data={
                'artifact_name': 'artifact_1',
                'artifactpriority': artifactpriority_id,
                'artifactstatus': artifactstatus_id,
                'artifacttype': artifacttype_id,
                'system': system_id,
                'artifact_sha256': 'z' * 64,
            })
        # compare
        self.assertFalse(form.is_valid())
Ejemplo n.º 6
0
    def test_artifact_form_empty(self):
        """test minimum form requirements / INVALID"""

        # get object
        form = ArtifactForm(data={})
        # compare
        self.assertFalse(form.is_valid())
Ejemplo n.º 7
0
    def test_artifact_sha256_too_less_chars(self):
        """test for min length"""

        # get object
        artifactpriority_id = Artifactpriority.objects.get(
            artifactpriority_name='artifactpriority_1').artifactpriority_id
        # get object
        artifactstatus_id = Artifactstatus.objects.get(
            artifactstatus_name='artifactstatus_1').artifactstatus_id
        # get object
        artifacttype_id = Artifacttype.objects.get(
            artifacttype_name='artifacttype_1').artifacttype_id
        # get object
        system_id = System.objects.get(system_name='system_1').system_id
        # get object
        form = ArtifactForm(
            data={
                'artifact_name': 'artifact_1',
                'artifactpriority': artifactpriority_id,
                'artifactstatus': artifactstatus_id,
                'artifacttype': artifacttype_id,
                'system': system_id,
                'artifact_sha256': 'c' * 63,
            })
        # compare
        self.assertFalse(form.is_valid())
Ejemplo n.º 8
0
    def test_artifact_name_form_filled(self):
        """test minimum form requirements / INVALID"""

        # get object
        form = ArtifactForm(data={
            'artifact_name': 'artifact_1',
        })
        # compare
        self.assertFalse(form.is_valid())
Ejemplo n.º 9
0
    def test_artifact_artifactstatus_form_filled(self):
        """ test minimum form requirements / INVALID """

        # get object
        artifactstatus_id = Artifactstatus.objects.get(artifactstatus_name='artifactstatus_1').artifactstatus_id
        # get object
        form = ArtifactForm(data = {
            'artifact_name': 'artifact_1',
            'artifactstatus': artifactstatus_id,
        })
        # compare
        self.assertFalse(form.is_valid())
Ejemplo n.º 10
0
    def test_artifact_sha256_form_label(self):
        """test form label"""

        # get object
        form = ArtifactForm()
        # compare
        self.assertEqual(form.fields['artifact_sha256'].label, 'SHA256')
Ejemplo n.º 11
0
    def test_artifact_md5_form_label(self):
        """test form label"""

        # get object
        form = ArtifactForm()
        # compare
        self.assertEqual(form.fields['artifact_md5'].label, 'MD5')
Ejemplo n.º 12
0
    def test_artifact_acquisition_time_form_label(self):
        """ test form label """

        # get object
        form = ArtifactForm()
        # compare
        self.assertEqual(form.fields['artifact_acquisition_time'].label, 'Artifact acquisition time (YYYY-MM-DD HH:MM:SS)')
Ejemplo n.º 13
0
    def test_artifact_case_form_label(self):
        """ test form label """

        # get object
        form = ArtifactForm()
        # compare
        self.assertEqual(form.fields['case'].label, 'Case')
Ejemplo n.º 14
0
    def test_artifact_system_form_label(self):
        """ test form label """

        # get object
        form = ArtifactForm()
        # compare
        self.assertEqual(form.fields['system'].label, 'System (*)')
Ejemplo n.º 15
0
    def test_artifact_source_path_form_label(self):
        """ test form label """

        # get object
        form = ArtifactForm()
        # compare
        self.assertEqual(form.fields['artifact_source_path'].label, 'Artifact source path')
Ejemplo n.º 16
0
    def test_artifact_artifacttype_form_label(self):
        """ test form label """

        # get object
        form = ArtifactForm()
        # compare
        self.assertEqual(form.fields['artifacttype'].label, 'Artifacttype (*)')
Ejemplo n.º 17
0
    def test_artifact_tag_form_label(self):
        """test form label"""

        # get object
        form = ArtifactForm()
        # compare
        self.assertEqual(form.fields['tag'].label, 'Tags')
Ejemplo n.º 18
0
    def test_artifact_artifactstatus_form_label(self):
        """ test form label """

        # get object
        form = ArtifactForm()
        # compare
        self.assertEquals(form.fields['artifactstatus'].label,
                          'Artifactstatus (*)')
Ejemplo n.º 19
0
    def test_artifact_requested_time_form_label(self):
        """ test form label """

        # get object
        form = ArtifactForm()
        # compare
        self.assertEquals(form.fields['artifact_requested_time'].label,
                          'Artifact requested time (YYYY-MM-DD HH:MM:SS)')
Ejemplo n.º 20
0
    def test_artifact_note_analysisresult_form_label(self):
        """test form label"""

        # get object
        form = ArtifactForm()
        # compare
        self.assertEqual(form.fields['artifact_note_analysisresult'].label,
                         'Analysis result')
Ejemplo n.º 21
0
    def test_artifact_note_internal_form_label(self):
        """test form label"""

        # get object
        form = ArtifactForm()
        # compare
        self.assertEqual(form.fields['artifact_note_internal'].label,
                         'Internal note')
Ejemplo n.º 22
0
    def test_artifact_source_path_form_filled(self):
        """ test additional form content """

        # get object
        artifactstatus_id = Artifactstatus.objects.get(artifactstatus_name='artifactstatus_1').artifactstatus_id
        # get object
        artifacttype_id = Artifacttype.objects.get(artifacttype_name='artifacttype_1').artifacttype_id
        # get object
        system_id = System.objects.get(system_name='system_1').system_id
        # get object
        form = ArtifactForm(data = {
            'artifact_name': 'artifact_1',
            'artifactstatus': artifactstatus_id,
            'artifacttype': artifacttype_id,
            'system': system_id,
            'artifact_source_path': 'C:\Windows\foo\bar',
        })
        # compare
        self.assertTrue(form.is_valid())
Ejemplo n.º 23
0
    def test_artifact_acquisiton_time_form_filled(self):
        """ test additional form content """

        # get object
        artifactstatus_id = Artifactstatus.objects.get(artifactstatus_name='artifactstatus_1').artifactstatus_id
        # get object
        artifacttype_id = Artifacttype.objects.get(artifacttype_name='artifacttype_1').artifacttype_id
        # get object
        system_id = System.objects.get(system_name='system_1').system_id
        # get object
        form = ArtifactForm(data = {
            'artifact_name': 'artifact_1',
            'artifactstatus': artifactstatus_id,
            'artifacttype': artifacttype_id,
            'system': system_id,
            'artifact_acquisiton_time': timezone.now(),
        })
        # compare
        self.assertTrue(form.is_valid())
Ejemplo n.º 24
0
    def test_artifact_sha1_too_many_chars(self):
        """ test for max length """

        # get object
        artifactstatus_id = Artifactstatus.objects.get(artifactstatus_name='artifactstatus_1').artifactstatus_id
        # get object
        artifacttype_id = Artifacttype.objects.get(artifacttype_name='artifacttype_1').artifacttype_id
        # get object
        system_id = System.objects.get(system_name='system_1').system_id
        # get object
        form = ArtifactForm(data = {
            'artifact_name': 'artifact_1',
            'artifactstatus': artifactstatus_id,
            'artifacttype': artifacttype_id,
            'system': system_id,
            'artifact_sha1': 'sssssssssssssssssssssssssssssssssssssssss',
        })
        # compare
        self.assertFalse(form.is_valid())
Ejemplo n.º 25
0
    def test_artifact_acquisiton_time_formatcheck(self):
        """ test input format """

        # get object
        artifactstatus_id = Artifactstatus.objects.get(artifactstatus_name='artifactstatus_1').artifactstatus_id
        # get object
        artifacttype_id = Artifacttype.objects.get(artifacttype_name='artifacttype_1').artifacttype_id
        # get object
        system_id = System.objects.get(system_name='system_1').system_id
        # get object
        form = ArtifactForm(data = {
            'artifact_name': 'artifact_1',
            'artifactstatus': artifactstatus_id,
            'artifacttype': artifacttype_id,
            'system': system_id,
            'artifact_acquisition_time': 'wrong format',
        })
        # compare
        self.assertFalse(form.is_valid())