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)
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)
def test_call_nok(self, get_file): get_file.return_value = None update_cwe() self.assertEqual(Search().index(CweDocument.Index.name).count(), 0)
def test_call_nok(self, get_file): get_file.return_value = None update_cwe() self.assertEqual(models.Cwe.objects.count(), 0)