use of com.seleniumtests.connectors.tms.squash.SquashTMApi in project seleniumRobot by bhecquet.
the class TestSquashTMApi method testCreateIteration.
@Test(groups = { "ut" })
public void testCreateIteration() {
PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project1");
doReturn(Arrays.asList(iteration1, iteration2)).when(campaign1).getIterations();
Iteration iteration3 = spy(new Iteration("http://localhost:4321/iterations/3", 3, "myIteration"));
PowerMockito.when(Iteration.create(campaign1, "myIteration")).thenReturn(iteration3);
Assert.assertEquals(api.createIteration(campaign1, "myIteration"), iteration3);
// check campaign creation has been called
PowerMockito.verifyStatic(Iteration.class);
Iteration.create(campaign1, "myIteration");
}
use of com.seleniumtests.connectors.tms.squash.SquashTMApi in project seleniumRobot by bhecquet.
the class TestSquashTMApi method testServerInError.
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testServerInError() {
createServerMock("GET", "/api/rest/latest/projects", 500, "{}");
PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project1");
}
use of com.seleniumtests.connectors.tms.squash.SquashTMApi in project seleniumRobot by bhecquet.
the class TestSquashTMApi method testGetExistingProject.
@Test(groups = { "ut" })
public void testGetExistingProject() {
PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project1");
Assert.assertEquals(api.getCurrentProject(), project1);
}
use of com.seleniumtests.connectors.tms.squash.SquashTMApi in project seleniumRobot by bhecquet.
the class TestSquashTMApi method testCreateCampaignWithFolder.
/**
* Check that folders are created when they to not exist for this project
*/
@Test(groups = { "ut" })
public void testCreateCampaignWithFolder() {
PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
doReturn(Arrays.asList(campaign1, campaign2)).when(project1).getCampaigns();
PowerMockito.when(CampaignFolder.getAll()).thenReturn(Arrays.asList(campaignFolder1, campaignFolder2));
Campaign myCampaign = new Campaign("http://localhost:4321/campaigns/3", 3, "mycampaign");
PowerMockito.when(Campaign.create(project1, "mycampaign", null)).thenReturn(myCampaign);
SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project1");
Campaign newCampaign = api.createCampaign("mycampaign", "myFolder/folder1");
Assert.assertEquals(newCampaign, myCampaign);
// check campaign creation has been called
PowerMockito.verifyStatic(Campaign.class);
Campaign.create(project1, "mycampaign", null);
// check 2 folders has been created
PowerMockito.verifyStatic(CampaignFolder.class);
CampaignFolder.create(eq(project1), any(), eq("myFolder"));
PowerMockito.verifyStatic(CampaignFolder.class);
CampaignFolder.create(eq(project1), any(), eq("folder1"));
}
Aggregations