示例#1
0
 def test_success(self, find_group, mock_unassign):
     find_group.return_value = "el"
     cmd_acl.unassign_role_from_group(self.mock_env, "role_id", "el_id",
                                      False)
     self.assert_get_cib_called()
     find_group.assert_called_once_with(self.cib, "el_id")
     mock_unassign.assert_called_once_with("el", "role_id", False)
     self.assert_same_cib_pushed()
示例#2
0
 def test_success_autodelete(self, mock_error_convert, mock_find_el, mock_unassign):
     mock_find_el.return_value = "el"
     cmd_acl.unassign_role_from_group(self.mock_env, "role_id", "el_id", True)
     self.assert_get_cib_called()
     mock_find_el.assert_called_once_with(self.cib, "el_id")
     mock_unassign.assert_called_once_with("el", "role_id", True)
     self.assert_same_cib_pushed()
     self.assertEqual(0, mock_error_convert.call_count)
示例#3
0
 def test_success(self, mock_error_convert, mock_find_el, mock_unassign):
     mock_find_el.return_value = "el"
     cmd_acl.unassign_role_from_group(self.mock_env, "role_id", "el_id",
                                      False)
     self.assert_get_cib_called()
     mock_find_el.assert_called_once_with(self.cib, "el_id")
     mock_unassign.assert_called_once_with("el", "role_id", False)
     self.assert_same_cib_pushed()
     self.assertEqual(0, mock_error_convert.call_count)
示例#4
0
 def test_success(self, find_group, mock_unassign):
     find_group.return_value = "el"
     cmd_acl.unassign_role_from_group(
         self.mock_env, "role_id", "el_id", False
     )
     self.assert_get_cib_called()
     find_group.assert_called_once_with(self.cib, "el_id")
     mock_unassign.assert_called_once_with("el", "role_id", False)
     self.assert_same_cib_pushed()
示例#5
0
 def test_failure(self, mock_error_convert, mock_find_el, mock_unassign):
     exception_obj = acl_lib.AclGroupNotFound("el_id")
     mock_find_el.side_effect = exception_obj
     self.assert_raises(
         LibraryError, lambda: cmd_acl.unassign_role_from_group(
             self.mock_env, "role_id", "el_id", False))
     self.assert_get_cib_called()
     mock_find_el.assert_called_once_with(self.cib, "el_id")
     self.assertEqual(0, mock_unassign.call_count)
     self.assert_cib_not_pushed()
     mock_error_convert.assert_called_once_with(exception_obj)
示例#6
0
 def test_failure(self, mock_error_convert, mock_find_el, mock_unassign):
     exception_obj = acl_lib.AclGroupNotFound("el_id")
     mock_find_el.side_effect = exception_obj
     self.assert_raises(
         LibraryError, lambda: cmd_acl.unassign_role_from_group(self.mock_env, "role_id", "el_id", False)
     )
     self.assert_get_cib_called()
     mock_find_el.assert_called_once_with(self.cib, "el_id")
     self.assertEqual(0, mock_unassign.call_count)
     self.assert_cib_not_pushed()
     mock_error_convert.assert_called_once_with(exception_obj)