def test_update_credentials_from_hive_action_when_jdbc_url_is_variable( self): class TestJob(object): XML_FILE_NAME = 'workflow.xml' def __init__(self): self.deployment_dir = '/tmp/test' self.nodes = [ Node({ 'id': '1', 'type': 'hive-document', 'properties': { 'jdbc_url': u"${wf:actionData('shell-31b5')['hiveserver']}", 'password': u'test' } }) ] user = User.objects.get(username='******') submission = Submission(user, job=TestJob(), fs=MockFs(logical_name='fsname'), jt=MockJt(logical_name='jtname')) finish = ( beeswax.conf.HIVE_SERVER_HOST.set_for_testing('hue-koh-chang'), beeswax.conf.HIVE_SERVER_PORT.set_for_testing(12345), ) try: creds = Credentials(credentials=TestCredentials.CREDENTIALS.copy()) hive_properties = { 'thrift_uri': 'thrift://*****:*****@test-realm.com', } submission.properties['credentials'] = creds.get_properties( hive_properties) submission._update_credentials_from_hive_action(creds) assert_equal( submission.properties['credentials'][ creds.hiveserver2_name]['properties'], [('hive2.jdbc.url', u'jdbc:hive2://hue-koh-chang:12345/default'), ('hive2.server.principal', u'hive/[email protected]') ]) finally: for f in finish: f()