コード例 #1
0
 def test_verify_config_default_trust_cert(self):
     mock_opts = {"fn_mcafee_atd": MockClass().mock}
     mock_opts["fn_mcafee_atd"]["trust_cert"] = "[True|False]"
     try:
         check_config(mock_opts)
     except ValueError as e:
         assert e.args[
             0] == "trust_cert is not set correctly, please set to True or False to run this function"
コード例 #2
0
 def test_verify_config_default_password(self):
     mock_opts = {"fn_mcafee_atd": MockClass().mock}
     mock_opts["fn_mcafee_atd"]["atd_password"] = "******"
     try:
         check_config(mock_opts)
     except ValueError as e:
         assert e.args[
             0] == "atd_password is still the default value, this must be changed to run this function"
コード例 #3
0
 def test_verify_config_no_atd_password(self):
     mock_opts = {"fn_mcafee_atd": MockClass().mock}
     del mock_opts["fn_mcafee_atd"]["atd_password"]
     try:
         check_config(mock_opts)
     except ValueError as e:
         assert e.args[
             0] == "atd_password is not set. You must set this value to run this function"
コード例 #4
0
    def test_verify_config_valid(self):
        mock_opts = {"fn_mcafee_atd": MockClass().mock}
        mock_opts["fn_mcafee_atd"]["trust_cert"] = "True"
        actual_config = check_config(mock_opts)

        expected_config = mock_opts["fn_mcafee_atd"]
        expected_config["timeout_mins"] = 30
        expected_config["polling_interval"] = 60
        expected_config["trust_cert"] = True

        assert actual_config == expected_config
コード例 #5
0
 def __init__(self, opts):
     """constructor provides access to the configuration options"""
     super(FunctionComponent, self).__init__(opts)
     # check_config is handling all of the error checking
     config_opts = check_config(opts)
     self.atd_url = config_opts.get("atd_url")
     self.atd_username = config_opts.get("atd_username")
     self.atd_password = config_opts.get("atd_password")
     self.timeout_mins = config_opts.get("timeout_mins")
     self.polling_interval = config_opts.get("polling_interval")
     self.vm_profile_list = config_opts.get("vm_profile_list")
     self.filePriority = config_opts.get("filePriority")
     self.trust_cert = config_opts.get("trust_cert")
コード例 #6
0
    def __init__(self, opts):
        """constructor provides access to the configuration options"""
        super(FunctionComponent, self).__init__(opts)
        # check_config is handling all of the error checking
        config_opts = check_config(opts)
        self.atd_url = config_opts.get("atd_url")
        self.atd_username = config_opts.get("atd_username")
        self.atd_password = config_opts.get("atd_password")
        self.timeout_mins = config_opts.get("timeout_mins")
        self.polling_interval = config_opts.get("polling_interval")
        self.vm_profile_list = config_opts.get("vm_profile_list")
        self.filePriority = config_opts.get("filePriority")
        self.trust_cert = config_opts.get("trust_cert")

        # Verify can make connection to ATD with given config values
        h = _get_atd_session_headers(self)
        # Logout after making connection
        atd_logout(self.atd_url, h, self.trust_cert)