浏览代码

AMBARI-9916. Fix minor issues with test_security_status test cases (rlevas)

Robert Levas 10 年之前
父节点
当前提交
33a84155f2

+ 6 - 15
ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py

@@ -567,7 +567,6 @@ class TestHBaseMaster(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import collections
 
     security_params = {
       'hbase-site': {
@@ -576,13 +575,6 @@ class TestHBaseMaster(RMFTestCase):
       }
     }
 
-    status_params = {
-      'kinit_path_local' : '/bin/kinit',
-      'hbase_user' : 'hbase',
-      'hostname' : 'localhost',
-      'tmp_dir' : '/thisdoesmotexost'
-    }
-
     result_issues = []
     props_value_check = {"hbase.security.authentication": "kerberos",
                            "hbase.security.authorization": "true"}
@@ -604,13 +596,12 @@ class TestHBaseMaster(RMFTestCase):
 
     build_exp_mock.assert_called_with('hbase-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
-    cached_kinit_executor_mock.called_with(status_params['kinit_path_local'],
-                              status_params['hbase_user'],
-                              security_params['hbase-site']['hbase.master.keytab.file'],
-                              security_params['hbase-site']['hbase.master.kerberos.principal'],
-                              status_params['hostname'],
-                              status_params['tmp_dir'],
-                              30)
+    cached_kinit_executor_mock.called_with('/usr/bin/kinit',
+                                           self.config_dict['configurations']['hbase-env']['hbase_user'],
+                                           security_params['hbase-site']['hbase.master.keytab.file'],
+                                           security_params['hbase-site']['hbase.master.kerberos.principal'],
+                                           self.config_dict['hostname'],
+                                           '/tmp')
 
      # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()

+ 0 - 1
ambari-server/src/test/python/stacks/2.0.6/HDFS/test_zkfc.py

@@ -346,7 +346,6 @@ class TestZkfc(RMFTestCase):
   @patch("resource_management.libraries.functions.security_commons.cached_kinit_executor")
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
-    print "HELLO WORLD!!!!"
 
     # Test that function works when is called with correct parameters
     security_params = {