Exemplo n.º 1
0
    def test_handle_uploaded_unit(self):
        # Setup
        initialized_unit = mock.MagicMock()
        initialized_unit.storage_path = self.dest_dir
        self.conduit.init_unit.return_value = initialized_unit

        # Test
        upload.handle_uploaded_unit(self.repo, constants.TYPE_PUPPET_MODULE, self.unit_key,
                                    self.unit_metadata, self.source_file, self.conduit)

        # Verify
        self.assertTrue(os.path.exists(self.dest_file))

        self.assertEqual(1, self.conduit.init_unit.call_count)
        self.assertEqual(1, self.conduit.save_unit.call_count)
Exemplo n.º 2
0
 def upload_unit(self, repo, type_id, unit_key, metadata, file_path, conduit,
                 config):
     upload.handle_uploaded_unit(type_id, unit_key, metadata, file_path, conduit)