use of com.seleniumtests.connectors.tms.squash.entities.Project in project seleniumRobot by bhecquet.
the class TestCampaignFolder method testFromJsonWithProject.
@Test(groups = { "ut" })
public void testFromJsonWithProject() {
JSONObject json = new JSONObject();
json.put("_type", "campaign-folder");
json.put("id", 1);
json.put("name", "foo");
json.put("_links", new JSONObject("{\"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/campaign-folder/1\"" + " }}"));
json.put("project", new JSONObject("{\r\n" + " \"_type\" : \"project\",\r\n" + " \"id\" : 10,\r\n" + " \"name\" : \"Mangrove\",\r\n" + " \"_links\" : {\r\n" + " \"self\" : {\r\n" + " \"href\" : \"http://localhost:8080/api/rest/latest/project/10\"\r\n" + " }\r\n" + " }}"));
CampaignFolder campaignFolder = CampaignFolder.fromJson(json);
Assert.assertEquals(campaignFolder.getId(), 1);
Assert.assertEquals(campaignFolder.getName(), "foo");
Assert.assertEquals(campaignFolder.getUrl(), "http://localhost:8080/api/rest/latest/campaign-folder/1");
Assert.assertTrue(campaignFolder.getProject() instanceof Project);
Assert.assertEquals(campaignFolder.getProject().getId(), 10);
}
use of com.seleniumtests.connectors.tms.squash.entities.Project in project seleniumRobot by bhecquet.
the class TestCampaignFolder method init.
@BeforeMethod(groups = { "ut" })
public void init() {
project = new Project("http://localhost:8080/api/rest/latest/projects/14", 14, "Test Project 1");
Campaign.configureEntity("user", "pwd", SERVER_URL + "/");
}
use of com.seleniumtests.connectors.tms.squash.entities.Project in project seleniumRobot by bhecquet.
the class TestCampaignFolder method testFromJsonParentIsProject.
@Test(groups = { "ut" })
public void testFromJsonParentIsProject() {
JSONObject json = new JSONObject();
json.put("_type", "campaign-folder");
json.put("id", 1);
json.put("name", "foo");
json.put("_links", new JSONObject("{\"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/campaign-folder/1\"" + " }}"));
json.put("parent", new JSONObject("{\r\n" + " \"_type\" : \"project\",\r\n" + " \"id\" : 10,\r\n" + " \"name\" : \"Mangrove\",\r\n" + " \"_links\" : {\r\n" + " \"self\" : {\r\n" + " \"href\" : \"http://localhost:8080/api/rest/latest/project/10\"\r\n" + " }\r\n" + " }}"));
CampaignFolder campaignFolder = CampaignFolder.fromJson(json);
Assert.assertEquals(campaignFolder.getId(), 1);
Assert.assertEquals(campaignFolder.getName(), "foo");
Assert.assertEquals(campaignFolder.getUrl(), "http://localhost:8080/api/rest/latest/campaign-folder/1");
Assert.assertTrue(campaignFolder.getParent() instanceof Project);
Assert.assertEquals(campaignFolder.getParent().getId(), 10);
}
use of com.seleniumtests.connectors.tms.squash.entities.Project in project seleniumRobot by bhecquet.
the class TestProject method testFromJson.
@Test(groups = { "ut" })
public void testFromJson() {
JSONObject json = new JSONObject();
json.put("_type", "project");
json.put("id", 1);
json.put("name", "foo");
json.put("_links", new JSONObject("{\"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/projects/1\"" + " }}"));
Project project = Project.fromJson(json);
Assert.assertEquals(project.getId(), 1);
Assert.assertEquals(project.getName(), "foo");
Assert.assertEquals(project.getUrl(), "http://localhost:8080/api/rest/latest/projects/1");
}
use of com.seleniumtests.connectors.tms.squash.entities.Project in project seleniumRobot by bhecquet.
the class TestProject method testAsJson.
@Test(groups = { "ut" })
public void testAsJson() {
Project project = new Project("http://localhost:8080/api/rest/latest/projects/1", 1, "project");
JSONObject json = project.asJson();
Assert.assertEquals(json.getInt("id"), 1);
Assert.assertEquals(json.getString("_type"), "project");
}
Aggregations