Пример #1
0
    def test_call(self, get_file):
        file = open(get_fixture_location(__file__, 'cwec_v2.12.xml'))
        get_file.return_value = file

        update_cwe()

        get_file.assert_called_once_with('https://cwe.mitre.org/data/xml/cwec_v2.12.xml.zip')
        self.assertEqual(models.Cwe.objects.count(), 2)
Пример #2
0
    def test_call(self, get_file):
        file = open(get_fixture_location(__file__, 'cwec_v2.12.xml'))
        get_file.return_value = file

        update_cwe()

        get_file.assert_called_once_with(
            'https://cwe.mitre.org/data/xml/cwec_v2.12.xml.zip')
        self.assertEqual(Search().index(CweDocument.Index.name).count(), 2)
Пример #3
0
    def test_call_nok(self, get_file):
        get_file.return_value = None

        update_cwe()

        self.assertEqual(Search().index(CweDocument.Index.name).count(), 0)
Пример #4
0
    def test_call_nok(self, get_file):
        get_file.return_value = None

        update_cwe()

        self.assertEqual(models.Cwe.objects.count(), 0)