Exemple #1
0
 def test_force_upload(self):
     """
     Upload: --force-upload causes unconditional file uploads
     """
     item = MagicMock()
     filepath = '/some/file'
     self.assertTrue(should_upload(filepath, item, True))
Exemple #2
0
 def test_force_upload(self):
     """
     Upload: --force-upload causes unconditional file uploads
     """
     item = MagicMock()
     filepath = '/some/file'
     self.assertTrue(should_upload(filepath, item, True))
Exemple #3
0
 def test_upload_missing(self):
     """
     Upload: Missing files are uploaded
     """
     item = None
     filepath = '/path/to/a/missing/file.rpm'
     with patch('os.path.exists',MagicMock(return_value=False)):
         self.assertTrue(should_upload(filepath, item, False))
     return
Exemple #4
0
 def test_upload_missing(self):
     """
     Upload: Missing files are uploaded
     """
     item = None
     filepath = '/path/to/a/missing/file.rpm'
     with patch('os.path.exists', MagicMock(return_value=False)):
         self.assertTrue(should_upload(filepath, item, False))
     return
Exemple #5
0
 def test_md5_eq_local_newer(self):
     """
     Don't Upload: 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_upload(filepath, item, False))
     return
Exemple #6
0
 def test_md5_eq_local_newer(self):
     """
     Don't Upload: 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_upload(filepath, item, False))
     return
Exemple #7
0
 def test_md5_diff_remote_newer(self):
     """
     Upload: 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.assertFalse(should_upload(filepath, item, False))
     return
Exemple #8
0
 def test_md5_diff_remote_newer(self):
     """
     Upload: 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.assertFalse(should_upload(filepath, item, False))
     return