Exemplo n.º 1
0
 def test_force_download(self):
     """
     Download: --force-download causes unconditional file downloads
     """
     item = MagicMock()
     filepath = '/some/file'
     self.assertTrue(should_download(item, filepath, True))
Exemplo n.º 2
0
 def test_force_download(self):
     """
     Download: --force-download causes unconditional file downloads
     """
     item = MagicMock()
     filepath = '/some/file'
     self.assertTrue(should_download(item, filepath, True))
Exemplo n.º 3
0
 def test_download_missing(self):
     """
     Download: Missing files are downloaded
     """
     item = MagicMock()
     filepath = '/path/to/a/missing/file.rpm'
     with patch('os.path.exists',MagicMock(return_value=False)):
         self.assertTrue(should_download(item, filepath, False))
     return
Exemplo n.º 4
0
 def test_download_missing(self):
     """
     Download: Missing files are downloaded
     """
     item = MagicMock()
     filepath = '/path/to/a/missing/file.rpm'
     with patch('os.path.exists', MagicMock(return_value=False)):
         self.assertTrue(should_download(item, filepath, False))
     return
Exemplo n.º 5
0
 def test_md5_eq_local_newer(self):
     """
     Don't Download: identical md5, local newer
     """
     item = MagicMock()
     filepath = '/path/to/a/missing/file.rpm'
     with patch('os.path.exists',MagicMock(return_value=True)), \
          patch('s3yum.s3yum_cli.mtime_as_datetime',
                 MagicMock(return_value=datetime.datetime(2015,1,1))), \
          patch('s3yum.s3yum_cli.s3time_as_datetime',
                 MagicMock(return_value=datetime.datetime(2014,1,1))), \
          patch('s3yum.s3yum_cli.md5_matches', MagicMock(return_value=True)):
         self.assertFalse(should_download(item, filepath, False))
     return
Exemplo n.º 6
0
 def test_md5_eq_local_newer(self):
     """
     Don't Download: identical md5, local newer
     """
     item = MagicMock()
     filepath = '/path/to/a/missing/file.rpm'
     with patch('os.path.exists',MagicMock(return_value=True)), \
          patch('s3yum.s3yum_cli.mtime_as_datetime',
                 MagicMock(return_value=datetime.datetime(2015,1,1))), \
          patch('s3yum.s3yum_cli.s3time_as_datetime',
                 MagicMock(return_value=datetime.datetime(2014,1,1))), \
          patch('s3yum.s3yum_cli.md5_matches', MagicMock(return_value=True)):
         self.assertFalse(should_download(item, filepath, False))
     return
Exemplo n.º 7
0
 def test_md5_diff_remote_newer(self):
     """
     Download: md5 differs, remote is newer
     """
     item = MagicMock()
     filepath = '/path/to/a/missing/file.rpm'
     with patch('os.path.exists',MagicMock(return_value=True)), \
          patch('s3yum.s3yum_cli.mtime_as_datetime',
                 MagicMock(return_value=datetime.datetime(2014,1,1))), \
          patch('s3yum.s3yum_cli.s3time_as_datetime',
                 MagicMock(return_value=datetime.datetime(2015,1,1))), \
          patch('s3yum.s3yum_cli.md5_matches',
                MagicMock(return_value=False)):
         self.assertTrue(should_download(item, filepath, False))
     return
Exemplo n.º 8
0
 def test_md5_diff_remote_newer(self):
     """
     Download: md5 differs, remote is newer
     """
     item = MagicMock()
     filepath = '/path/to/a/missing/file.rpm'
     with patch('os.path.exists',MagicMock(return_value=True)), \
          patch('s3yum.s3yum_cli.mtime_as_datetime',
                 MagicMock(return_value=datetime.datetime(2014,1,1))), \
          patch('s3yum.s3yum_cli.s3time_as_datetime',
                 MagicMock(return_value=datetime.datetime(2015,1,1))), \
          patch('s3yum.s3yum_cli.md5_matches',
                MagicMock(return_value=False)):
         self.assertTrue(should_download(item, filepath, False))
     return