Exemplo n.º 1
0
TEST_F(TestBCGroup, RejectGroupInvitation)
{
	Authenticate(UserA);
	CreateGroup();

	TestResult tr;
	m_bc->getGroupService()->inviteGroupMember(
		_groupId.c_str(),
		GetUser(UserB)->m_profileId,
		eGroupMember::ADMIN,
		"",
		&tr);
	tr.run(m_bc);

	Logout();
	Authenticate(UserB);

	m_bc->getGroupService()->rejectGroupInvitation(
		_groupId.c_str(),
		&tr);
	tr.run(m_bc);

	Logout();
	DeleteGroupAsUserA();
}
void TestBCOneWayMatch::StartMatch()
{
    TestResult tr;
    m_bc->getOneWayMatchService()->startMatch(GetUser(UserB)->m_profileId, 100, &tr);
    tr.run(m_bc);
    tr.reset();
    
    m_bc->getPlaybackStreamService()->getStreamSummariesForTargetPlayer(GetUser(UserB)->m_profileId, &tr);
    tr.run(m_bc);
    
    Json::Value streams = tr.m_response["data"]["streams"];
    
    m_streamId = streams[0u]["playbackStreamId"].asString();
}
Exemplo n.º 3
0
TEST_F(TestBCEntity, DeleteSingleton)
{
	TestResult tr;
	TestBCEntity::CreateDefaultEntity();
	m_bc->getEntityService()->deleteSingleton(m_entityType, -1, &tr);
	tr.run(m_bc);
}
TEST_F(TestBCPlayerState, UpdatePlayerPictureUrl)
{
    Authenticate();
    TestResult tr;
    m_bc->getPlayerStateService()->updatePlayerPictureUrl("https://some.domain.com/mypicture.jpg", &tr);
    tr.run(m_bc);
}
TEST_F(TestBCOneWayMatch, CompleteMatch)
{
    StartMatch();
    TestResult tr;
    m_bc->getOneWayMatchService()->completeMatch(m_streamId.c_str(), &tr);
    tr.run(m_bc);
}
TEST_F(TestBCPlayerState, UpdateContactEmail)
{
    Authenticate();
    TestResult tr;
    m_bc->getPlayerStateService()->updateContactEmail(GetUser(UserA)->m_email, &tr);
    tr.run(m_bc);
}
Exemplo n.º 7
0
TEST_F(TestBCEntity, Delete)
{
	TestResult tr;
	TestBCEntity::CreateDefaultEntity();
	m_bc->getEntityService()->deleteEntity(m_entityId.c_str(), -1, &tr);
	tr.run(m_bc);
}
Exemplo n.º 8
0
void TestBCEntity::DeleteAllDefaultEntities()
{
	TestResult tr;
	m_bc->getEntityService()->getEntitiesByType(m_entityType, &tr);
	if (tr.run(m_bc))
	{
		Json::Value entityArray = tr.m_response["data"]["entities"];

		/* for some reason, marmalade goes past entityArray.end() so we do this via indices
		Json::Value::iterator it;
		for (it = entityArray.begin(); it !=entityArray.end(); ++it)
		{
		Json::Value key = it.key(); // why get this?
		Json::Value value = (*it);

		DeleteEntity(value["entityId"].asString());
		}
		*/

		for (int i = 0, isize = entityArray.size(); i < isize; ++i)
		{
			Json::Value value = entityArray[i];
			DeleteEntity(value["entityId"].asString());
		}
		m_entityId = tr.m_response["data"]["entityId"].asString();
	}
}
Exemplo n.º 9
0
void TestBCEntity::DeleteEntity(std::string entityId)
{
	if (entityId.length() <= 0) entityId = m_entityId;
	TestResult tr;
	m_bc->getEntityService()->deleteEntity(entityId.c_str(), -1, &tr);
	tr.run(m_bc);
}
TEST_F(TestBCPlayerState, Logout)
{
    Authenticate();
    TestResult tr;
    m_bc->getPlayerStateService()->logout(&tr);
    tr.run(m_bc);
}
TEST_F(TestBCPlayerState, UpdateSummaryFriendData)
{
    Authenticate();
    TestResult tr;
    m_bc->getPlayerStateService()->updateSummaryFriendData("{\"field\":\"value\"}", &tr);
    tr.run(m_bc);
}
TEST_F(TestBCAsyncMatch, ReadMatchHistory)
{
    TestBCAsyncMatch::CreateMatch();
    TestResult tr;
    m_bc->getAsyncMatchService()->readMatchHistory(GetUser(UserA)->m_profileId, m_matchId.c_str(), &tr);
    tr.run(m_bc);
    TestBCAsyncMatch::AbandonMatch();
}
TEST_F(TestBCAsyncMatch, FindMatches)
{
    TestBCAsyncMatch::CreateMatch();
    TestResult tr;
    m_bc->getAsyncMatchService()->findMatches(&tr);
    tr.run(m_bc);
    TestBCAsyncMatch::AbandonMatch();
}
TEST_F(TestBCAsyncMatch, Complete)
{
    TestBCAsyncMatch::CreateMatchWithInitialTurn();
    
    TestResult tr;
    m_bc->getAsyncMatchService()->completeMatch(GetUser(UserA)->m_profileId, m_matchId.c_str(), &tr);
    tr.run(m_bc);
}
Exemplo n.º 15
0
TEST_F(TestBCEntity, GetSharedEntitiesForPlayerId)
{
	TestResult tr;
	CreateDefaultEntity();
	m_bc->getEntityService()->getSharedEntitiesForPlayerId(GetUser(UserA)->m_profileId, &tr);
	tr.run(m_bc);
	DeleteEntity();
}
Exemplo n.º 16
0
TEST_F(TestBCEntity, IncrementSharedUserEntityData)
{
	TestResult tr;
	Json::Value entityData;
	entityData["test"] = 1233;

	std::string entityId;

	Json::FastWriter fw;
	m_bc->getEntityService()->createEntity(m_entityType, fw.write(entityData), "", &tr);
	if (tr.run(m_bc)) entityId = tr.m_response["data"]["entityId"].asString();

	m_bc->getEntityService()->incrementSharedUserEntityData(entityId.c_str(), GetUser(UserA)->m_profileId, fw.write(entityData), &tr);
	tr.run(m_bc);

	DeleteEntity(entityId);
}
Exemplo n.º 17
0
TEST_F(TestBCEntity, GetEntitesByType)
{
	TestResult tr;
	TestBCEntity::CreateDefaultEntity();
	m_bc->getEntityService()->getEntitiesByType(m_entityType, &tr);
	tr.run(m_bc);
	TestBCEntity::DeleteEntity();
}
TEST_F(TestBCPlayerState, UpdatePlayerName)
{
    Authenticate();
    TestResult tr;
    m_bc->getPlayerStateService()->updatePlayerName(GetUser(UserA)->m_id, &tr);
    tr.run(m_bc);
    Logout();
}
TEST_F(TestBCPlayerState, ReadPlayerState)
{
    Authenticate();
    TestResult tr;
    m_bc->getPlayerStateService()->readPlayerState(&tr);
    tr.run(m_bc);
    Logout();
}
TEST_F(TestBCPlayerState, GetAttributes)
{
    Authenticate();
    TestResult tr;
    m_bc->getPlayerStateService()->getAttributes(&tr);
    tr.run(m_bc);
    Logout();
}
Exemplo n.º 21
0
void TestBCGroup::DeleteGroup()
{
	TestResult tr;
	m_bc->getGroupService()->deleteGroup(
		_groupId.c_str(),
		-1,
		&tr);
	tr.run(m_bc);
}
Exemplo n.º 22
0
void TestBCGroup::Authenticate(Users user)
{
	TestResult tr;
	m_bc->getAuthenticationService()->authenticateUniversal(
		GetUser(user)->m_id,
		GetUser(user)->m_password,
		true,
		&tr);
	tr.run(m_bc);
}
TEST_F(TestBCPlayerState, UpdateAttributes)
{
    Authenticate();
    TestResult tr;
    Json::FastWriter fw;
    Json::Value stats;
    stats["testAttribute1"] = "10";
    stats["testAttribute2"] = "20";
    m_bc->getPlayerStateService()->updateAttributes(fw.write(stats), true, &tr);
    tr.run(m_bc);
    Logout();
}
Exemplo n.º 24
0
TEST_F(TestBCEntity, UpdateSingleton)
{
	TestResult tr;
	Json::Value entityData;
	Json::FastWriter fw;

	entityData["address"] = "1309a Carling Ave, Ottawa ON";
	m_bc->getEntityService()->updateSingleton(m_entityType, fw.write(entityData), "", -1, &tr);
	tr.run(m_bc);

	DeleteEntity();
}
Exemplo n.º 25
0
inline bool TestRunner::run(Test* test)
{
    SCOPE_EXIT([=]{ delete test; });
                        
    TestResult result;
    addListeners(result);

    RepeatedTest repeated(*test, ROLE(TestOptions).repeat());
    result.run(repeated);

    return result.isSucc();
}
Exemplo n.º 26
0
TEST_F(TestBCGroup, ListGroupsWithMember)
{
	Authenticate(UserA);
	//CreateGroup();

	TestResult tr;
	m_bc->getGroupService()->listGroupsWithMember(
		GetUser(UserA)->m_profileId,
		&tr);
	tr.run(m_bc);

	Logout();
}
TEST_F(TestBCPlayerState, DeletePlayer)
{
    Authenticate();
    TestResult tr;
    m_bc->getPlayerStateService()->deletePlayer(&tr);
    tr.run(m_bc);
    
    // after having deleted a player, the cached profile id will be incorrect
    // in the cached array. So we fix it here...
    Authenticate();
    std::string profileId = m_bc->getAuthenticationService()->getProfileId();
    sprintf(GetUser(UserA)->m_profileId, "%s", profileId.c_str());
}
TEST_F(TestBCPlayerState, RemoveAttributes)
{
    Authenticate();
    TestResult tr;
    
    std::vector<std::string> attributes;
    attributes.push_back("testAttribute1");
    attributes.push_back("testAttribute2");
    
    m_bc->getPlayerStateService()->removeAttributes(attributes, &tr);
    tr.run(m_bc);
    Logout();
}
Exemplo n.º 29
0
TEST_F(TestBCGroup, ListGroupsPageByOffset)
{
	Authenticate(UserA);

	std::string context = CreateContext(10, 1, "groupType", _groupType);

	TestResult tr;
	m_bc->getGroupService()->listGroupsPage(
		context.c_str(),
		&tr);
	tr.run(m_bc);

	context = tr.m_response["data"]["context"].asString();

	m_bc->getGroupService()->listGroupsPageByOffset(
		context.c_str(),
		1,
		&tr);
	tr.run(m_bc);

	Logout();
}
Exemplo n.º 30
0
TEST_F(TestBCGroup, RemoveGroupMember)
{
	CreateGroupAsUserA(true);
	Authenticate(UserB);

	TestResult tr;
	m_bc->getGroupService()->joinGroup(
		_groupId.c_str(),
		&tr);
	tr.run(m_bc);

	Logout();
	Authenticate(UserA);

	m_bc->getGroupService()->removeGroupMember(
		_groupId.c_str(),
		GetUser(UserB)->m_profileId,
		&tr);
	tr.run(m_bc);

	DeleteGroup();
}