use of com.seleniumtests.connectors.selenium.SeleniumRobotVariableServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotVariableServerConnector method testVariableDereservation.
@Test(groups = { "ut" })
public void testVariableDereservation() throws UnirestException {
configureMockedVariableServerConnection();
SeleniumRobotVariableServerConnector connector = new SeleniumRobotVariableServerConnector(true, SERVER_URL, "Test1", null);
List<TestVariable> variables = new ArrayList<>(connector.getVariables().values());
connector.unreserveVariables(variables);
// only one dereservation should be called
PowerMockito.verifyStatic(Unirest.class);
Unirest.patch(ArgumentMatchers.contains(String.format(SeleniumRobotVariableServerConnector.EXISTING_VARIABLE_API_URL, 2)));
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotVariableServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotVariableServerConnector method testGetTestCaseIdWithoutToken.
/**
* Check tokens are not added to request when not provided
* @throws UnirestException
*/
@Test(groups = { "ut" })
public void testGetTestCaseIdWithoutToken() throws UnirestException {
configureMockedVariableServerConnection();
SeleniumRobotVariableServerConnector connector = new SeleniumRobotVariableServerConnector(true, SERVER_URL, "Test1", null);
Assert.assertEquals((int) connector.createTestCase("foo"), 3);
verify(namedTestCaseRequest, never()).header(eq("Authorization"), anyString());
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotVariableServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotVariableServerConnector method testVariableCreateNewVariable.
@Test(groups = { "ut" })
public void testVariableCreateNewVariable() throws UnirestException {
configureMockedVariableServerConnection();
SeleniumRobotVariableServerConnector connector = new SeleniumRobotVariableServerConnector(true, SERVER_URL, "Test1", null);
TestVariable existingVariable = new TestVariable("key", "value");
TestVariable variable = connector.upsertVariable(existingVariable, true);
PowerMockito.verifyStatic(Unirest.class);
Unirest.post(ArgumentMatchers.contains(SeleniumRobotVariableServerConnector.VARIABLE_API_URL));
Assert.assertEquals(variable.getValue(), "value");
Assert.assertEquals(variable.getName(), "key");
Assert.assertEquals(variable.getInternalName(), TestVariable.TEST_VARIABLE_PREFIX + "key");
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotVariableServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotVariableServerConnector method testVariableUpdateExistingVariable.
@Test(groups = { "ut" })
public void testVariableUpdateExistingVariable() throws UnirestException {
configureMockedVariableServerConnection();
SeleniumRobotVariableServerConnector connector = new SeleniumRobotVariableServerConnector(true, SERVER_URL, "Test1", null);
TestVariable existingVariable = new TestVariable(12, "key", "value", false, TestVariable.TEST_VARIABLE_PREFIX + "key");
TestVariable variable = connector.upsertVariable(existingVariable, true);
PowerMockito.verifyStatic(Unirest.class);
Unirest.patch(ArgumentMatchers.contains(SeleniumRobotVariableServerConnector.VARIABLE_API_URL));
Assert.assertEquals(variable.getValue(), "value");
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotVariableServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotVariableServerConnector method testServerActiveAndAlive.
@Test(groups = { "ut" })
public void testServerActiveAndAlive() throws UnirestException {
configureMockedVariableServerConnection();
SeleniumRobotVariableServerConnector connector = new SeleniumRobotVariableServerConnector(true, SERVER_URL, "Test1", null);
Assert.assertTrue(connector.getActive());
Assert.assertEquals(connector.getApplicationId(), 1);
Assert.assertEquals(connector.getEnvironmentId(), 2);
Assert.assertEquals((int) connector.createTestCase("Test1"), 3);
Assert.assertEquals(connector.getVersionId(), 4);
}
Aggregations