2020# for any legal advice.
2121# VulnerableCode is a free software code scanning tool from nexB Inc. and others.
2222# Visit https://github.com/nexB/vulnerablecode/ for support and download.
23+
2324import json
2425import os
26+ from dateutil import parser as dateparser
2527from unittest .mock import patch
2628from unittest .mock import MagicMock
2729
3638
3739
3840class DebianImportTest (TestCase ):
41+
3942 @classmethod
4043 def setUpClass (cls ) -> None :
4144 fixture_path = os .path .join (TEST_DATA , "debian.json" )
@@ -45,7 +48,7 @@ def setUpClass(cls) -> None:
4548 cls .importer = models .Importer .objects .create (
4649 name = "debian_unittests" ,
4750 license = "" ,
48- last_run = "2019-08-05 13:14:17.733232+05:30" ,
51+ last_run = dateparser . parse ( "2019-08-05 13:14:17.733232+05:30" ) ,
4952 data_source = "DebianDataSource" ,
5053 data_source_cfg = {"debian_tracker_url" : "https://security.example.com/json" },
5154 )
@@ -84,12 +87,12 @@ def test_response_is_new(self):
8487 mock_resp .headers = {"last-modified" : "Wed, 05 Aug 2021 09:12:19 GMT" }
8588
8689 with patch ("vulnerabilities.importers.debian.requests.head" , return_value = mock_resp ):
87- assert test_data_source .response_is_new () is True
90+ assert test_data_source .response_is_new ()
8891
89- mock_resp .headers = {"last-modified" : "Wed, 05 Aug 2019 09:12:19 GMT" }
92+ mock_resp .headers = {"last-modified" : "Wed, 04 Aug 2019 09:12:19 GMT" }
9093
9194 with patch ("vulnerabilities.importers.debian.requests.head" , return_value = mock_resp ):
92- assert test_data_source .response_is_new () is False
95+ assert not test_data_source .response_is_new ()
9396
9497 def assert_for_package (self , name , version , release , cve_ids = None ):
9598 qs = models .Package .objects .filter (
0 commit comments