def test_check_update__pkg_no_last_modified_and_no_install_date_and_version_higher_than_latest_version( self): mapper = AURDataMapper(i18n=Mock(), logger=Mock(), http_client=Mock()) pkg = ArchPackage(name='test') pkg.last_modified = None pkg.install_date = None pkg.version = '1.1.0' pkg.latest_version = '1.0.0' self.assertFalse(mapper.check_update(pkg=pkg, last_modified=1608143812))
def test_check_update__pkg_no_last_modified_and_install_date_and_no_last_modified_and_latest_higher( self): mapper = AURDataMapper(i18n=Mock(), logger=Mock(), http_client=Mock()) pkg = ArchPackage(name='test') pkg.last_modified = None pkg.install_date = 1608143812 pkg.version = '1.0.0' pkg.latest_version = '1.1.0' # in this case, install_date will be considered instead of package's last_modified. # as 'install_date' is higher, only the string versions will be compared self.assertTrue(mapper.check_update(pkg=pkg, last_modified=None))
def test_check_update__pkg_no_last_modified_and_install_date_less_than_last_modified_and_version_higher_than_latest( self): mapper = AURDataMapper(i18n=Mock(), logger=Mock(), http_client=Mock()) pkg = ArchPackage(name='test') pkg.last_modified = None pkg.install_date = 1608143812 pkg.version = '3.0.0' pkg.latest_version = '2.0.0' # in this case, install_date will be considered instead of package's last_modified. # even that 'version' is higher than 'latest_version', 'last_modified' is greater than 'install_date' self.assertTrue( mapper.check_update(pkg=pkg, last_modified=pkg.install_date + 100))