Merge "add unit test cover oozie upload workflow file function"

This commit is contained in:
Jenkins 2015-08-19 13:41:31 +00:00 committed by Gerrit Code Review
commit 0580c380fc

View File

@ -76,6 +76,16 @@ class TestOozieEngine(base.SaharaTestCase):
res = oje._upload_job_files_to_hdfs(mock.Mock(), 'job_prefix', job, {}) res = oje._upload_job_files_to_hdfs(mock.Mock(), 'job_prefix', job, {})
self.assertEqual(['job_prefix/lib/main.jar'], res) self.assertEqual(['job_prefix/lib/main.jar'], res)
@mock.patch('sahara.utils.remote.get_remote')
def test_upload_workflow_file(self, remote_get):
oje = FakeOozieJobEngine(u.create_cluster())
remote_class = mock.MagicMock()
remote_class.__exit__.return_value = 'closed'
remote_get.return_value = remote_class
res = oje._upload_workflow_file(remote_get, "test", "hadoop.xml",
'hdfs')
self.assertEqual("test/workflow.xml", res)
@mock.patch('sahara.utils.remote.get_remote') @mock.patch('sahara.utils.remote.get_remote')
def test_hdfs_create_workflow_dir(self, remote): def test_hdfs_create_workflow_dir(self, remote):
remote_class = mock.MagicMock() remote_class = mock.MagicMock()