Example #1
0
 def test_module_fail_when_required_args_missing(self):
     """ required arguments are reported as errors """
     with pytest.raises(AnsibleFailJson) as exc:
         set_module_args(self.set_default_args_fail_check())
         grid_group_module()
     print("Info: test_module_fail_when_required_args_missing: %s" %
           exc.value.args[0]["msg"])
Example #2
0
 def test_module_fail_with_bad_unique_name(self):
     """ error returned if unique_name doesn't start with group or federated_group """
     with pytest.raises(AnsibleFailJson) as exc:
         args = self.set_default_args_pass_check()
         args["unique_name"] = "noprefixgroup"
         set_module_args(args)
         grid_group_module()
     print("Info: test_module_fail_with_bad_unique_name: %s" %
           exc.value.args[0]["msg"])
Example #3
0
 def test_module_fail_when_required_args_present(self):
     """ required arguments are reported as errors """
     with pytest.raises(AnsibleExitJson) as exc:
         set_module_args(self.set_default_args_pass_check())
         grid_group_module()
         exit_json(changed=True, msg="Induced arguments check")
     print("Info: test_module_fail_when_required_args_present: %s" %
           exc.value.args[0]["msg"])
     assert exc.value.args[0]["changed"]
Example #4
0
 def test_idempotent_create_na_sg_grid_group_pass(self, mock_request):
     set_module_args(self.set_args_create_na_sg_grid_group())
     my_obj = grid_group_module()
     mock_request.side_effect = [
         SRR["grid_group_record"],  # get
         SRR["end_of_sequence"],
     ]
     with pytest.raises(AnsibleExitJson) as exc:
         my_obj.apply()
     print("Info: test_idempotent_create_na_sg_grid_group_pass: %s" %
           repr(exc.value.args[0]))
     assert not exc.value.args[0]["changed"]
Example #5
0
    def test_update_na_sg_grid_group_pass(self, mock_request):
        args = self.set_args_create_na_sg_grid_group()
        args["management_policy"]["tenant_accounts"] = True
        args["management_policy"]["metrics_query"] = False
        args["management_policy"]["ilm"] = False

        set_module_args(args)
        my_obj = grid_group_module()
        mock_request.side_effect = [
            SRR["grid_group_record"],  # get
            SRR["grid_group_record_update"],  # put
            SRR["end_of_sequence"],
        ]
        with pytest.raises(AnsibleExitJson) as exc:
            my_obj.apply()
        print("Info: test_update_na_sg_grid_group_pass: %s" %
              repr(exc.value.args[0]))
        assert exc.value.args[0]["changed"]