Example #1
0
    def test_unsuccessful_copy(self, mock_copy, mock_get_relpath):
        # Set up the mock of create_copy to return False
        mock_copy.return_value = False
        mock_get_relpath.return_value = 'relative/path'

        # Test that both packages failed
        summary, details = export_utils.export_rpm('/fake/working/dir', self.rpm_list, None)
        self.assertEqual(2, mock_get_relpath.call_count)
        self.assertEqual(2, summary['num_package_units_errors'])
Example #2
0
    def test_successful_copy(self, mock_exists, mock_copy, mock_rel_path):
        # Setup
        mock_exists.return_value = True
        mock_rel_path.return_value = 'fake_path'
        mock_copy.return_value = True

        # Test that create_copy was called with the source path and the working dir joined with relpath
        summary, details = export_utils.export_rpm('/working/dir', self.rpm_list, None)
        self.assertEqual(('/fake/rpm1', '/working/dir/fake_path',), mock_copy.call_args_list[0][0])
        self.assertEqual(('/fake/rpm2', '/working/dir/fake_path',), mock_copy.call_args_list[1][0])
        self.assertEqual(2, summary['num_package_units_exported'])