示例#1
0
 def test_no_permission(self, mock_add_perm, mock_create_role, mock_validate):
     mock_create_role.return_value = "role el"
     cmd_acl.create_role(self.mock_env, "role_id", [], "desc")
     self.assert_get_cib_called()
     self.assertEqual(0, mock_validate.call_count)
     mock_create_role.assert_called_once_with(self.cib, "role_id", "desc")
     self.assertEqual(0, mock_add_perm.call_count)
     self.assert_same_cib_pushed()
示例#2
0
 def test_no_permission(self, mock_add_perm, mock_create_role,
                        mock_validate):
     mock_create_role.return_value = "role el"
     cmd_acl.create_role(self.mock_env, "role_id", [], "desc")
     self.assert_get_cib_called()
     self.assertEqual(0, mock_validate.call_count)
     mock_create_role.assert_called_once_with(self.cib, "role_id", "desc")
     self.assertEqual(0, mock_add_perm.call_count)
     self.assert_same_cib_pushed()
示例#3
0
 def test_success(self, mock_add_perm, mock_create_role, mock_validate):
     perm_list = ["my", "list"]
     mock_create_role.return_value = "role el"
     cmd_acl.create_role(self.mock_env, "role_id", perm_list, "desc")
     self.assert_get_cib_called()
     mock_validate.assert_called_once_with(self.cib, perm_list)
     mock_create_role.assert_called_once_with(self.cib, "role_id", "desc")
     mock_add_perm.assert_called_once_with("role el", perm_list)
     self.assert_same_cib_pushed()
示例#4
0
 def test_success(self, mock_add_perm, mock_create_role, mock_validate):
     perm_list = ["my", "list"]
     mock_create_role.return_value = "role el"
     cmd_acl.create_role(self.mock_env, "role_id", perm_list, "desc")
     self.assert_get_cib_called()
     mock_validate.assert_called_once_with(self.cib, perm_list)
     mock_create_role.assert_called_once_with(self.cib, "role_id", "desc")
     mock_add_perm.assert_called_once_with("role el", perm_list)
     self.assert_same_cib_pushed()