void Admintest::test_SetOperation_obj_IG() { Account_SetOperation_called = 0; long cid = m_id_counter++; Entity * c = new Entity(compose("%1", cid), cid); m_account->m_charactersDict.insert(std::make_pair(cid, c)); Atlas::Objects::Operation::Set op; OpVector res; Anonymous arg; arg->setObjtype("obj"); arg->setId(c->getId()); op->setArgs1(arg); m_account->SetOperation(op, res); ASSERT_EQUAL(Account_SetOperation_called, m_account); // The operation returned would have come from Account::SetOperation // but that is stubbed out ASSERT_EQUAL(res.size(), 0u); delete c; }
void Admintest::test_SetOperation_no_args() { Atlas::Objects::Operation::Set op; OpVector res; m_account->SetOperation(op, res); ASSERT_EQUAL(res.size(), 1u); ASSERT_EQUAL(res.front()->getClassNo(), Atlas::Objects::Operation::ERROR_NO); }
void Admintest::test_SetOperation_no_objtype() { Atlas::Objects::Operation::Set op; OpVector res; Anonymous arg; op->setArgs1(arg); m_account->SetOperation(op, res); ASSERT_EQUAL(res.size(), 1u); ASSERT_EQUAL(res.front()->getClassNo(), Atlas::Objects::Operation::ERROR_NO); }
void Admintest::test_SetOperation_unknown() { Atlas::Objects::Operation::Set op; OpVector res; Anonymous arg; arg->setObjtype("unimportant_unknown_string"); arg->setId("root"); op->setArgs1(arg); m_account->SetOperation(op, res); ASSERT_EQUAL(res.size(), 1u); ASSERT_EQUAL(res.front()->getClassNo(), Atlas::Objects::Operation::ERROR_NO); }
void Admintest::test_SetOperation_rule_unknown() { Ruleset_modifyRule_called = false; Atlas::Objects::Operation::Set op; OpVector res; Anonymous arg; arg->setObjtype("class"); arg->setId("unimportant_unmatched_string"); op->setArgs1(arg); m_account->SetOperation(op, res); ASSERT_EQUAL(res.size(), 1u); ASSERT_EQUAL(res.front()->getClassNo(), Atlas::Objects::Operation::ERROR_NO); ASSERT_TRUE(!Ruleset_modifyRule_called); }
void Admintest::test_SetOperation_rule_fail() { Ruleset_modifyRule_called = false; Ruleset_modifyRule_retval = -1; Atlas::Objects::Operation::Set op; OpVector res; Anonymous arg; arg->setObjtype("class"); arg->setId("root"); op->setArgs1(arg); m_account->SetOperation(op, res); ASSERT_EQUAL(res.size(), 1u); ASSERT_EQUAL(res.front()->getClassNo(), Atlas::Objects::Operation::ERROR_NO); ASSERT_TRUE(Ruleset_modifyRule_called); }
void Admintest::test_SetOperation_obj_not_found() { Account_SetOperation_called = 0; long cid = m_id_counter++; Atlas::Objects::Operation::Set op; OpVector res; Anonymous arg; arg->setObjtype("obj"); arg->setId(compose("%1", cid)); op->setArgs1(arg); m_account->SetOperation(op, res); ASSERT_NULL(Account_SetOperation_called); // FIXME No error? Is that right? ASSERT_EQUAL(res.size(), 0u); }