[mielecloud] Remove e-mail parameter validation (#11073)

Signed-off-by: Björn Lange <bjoern.lange@tu-dortmund.de>
This commit is contained in:
Björn Lange
2021-08-02 21:45:41 +02:00
committed by GitHub
parent 5b4b51f6ae
commit 699b7712c3
15 changed files with 5 additions and 184 deletions

View File

@@ -225,18 +225,4 @@ public class CreateBridgeServletTest extends AbstractConfigFlowTest {
assertTrue(website.contains("Pairing failed!"));
assertTrue(website.contains("Missing e-mail address."));
}
@Test
public void whenAMalformedEmailIsPassedToBridgeCreationThenTheBrowserIsRedirectedToTheFailurePageAndAnErrorIsShown()
throws Exception {
// when:
Website website = getCrawler()
.doGetRelative("/mielecloud/createBridgeThing?" + CreateBridgeServlet.BRIDGE_UID_PARAMETER_NAME + "="
+ MieleCloudBindingIntegrationTestConstants.BRIDGE_THING_UID.getAsString() + "&"
+ CreateBridgeServlet.EMAIL_PARAMETER_NAME + "=openhab.openhab.org");
// then:
assertTrue(website.contains("Pairing failed!"));
assertTrue(website.contains("Malformed e-mail address."));
}
}

View File

@@ -267,23 +267,4 @@ public class ForwardToLoginServletTest extends AbstractConfigFlowTest {
"Go to <a href=\"https://www.miele.com/f/com/en/register_api.aspx\">the Miele developer portal</a> to obtain your"));
assertTrue(maybePairAccountSite.contains("Missing e-mail address."));
}
@Test
public void whenAMalformedEmailIsPassedThenTheBrowserIsRedirectedToThePairSiteAndAWarningIsDisplayed()
throws Exception {
// when:
Website maybePairAccountSite = getCrawler()
.doGetRelative("/mielecloud/forwardToLogin?" + ForwardToLoginServlet.CLIENT_ID_PARAMETER_NAME + "="
+ MieleCloudBindingIntegrationTestConstants.CLIENT_ID + "&"
+ ForwardToLoginServlet.CLIENT_SECRET_PARAMETER_NAME + "="
+ MieleCloudBindingIntegrationTestConstants.CLIENT_SECRET + "&"
+ ForwardToLoginServlet.BRIDGE_ID_PARAMETER_NAME + "="
+ MieleCloudBindingIntegrationTestConstants.BRIDGE_ID + "&"
+ ForwardToLoginServlet.EMAIL_PARAMETER_NAME + "=not_an_Email");
// then:
assertTrue(maybePairAccountSite.contains(
"Go to <a href=\"https://www.miele.com/f/com/en/register_api.aspx\">the Miele developer portal</a> to obtain your"));
assertTrue(maybePairAccountSite.contains("Malformed e-mail address"));
}
}

View File

@@ -131,16 +131,4 @@ public class SuccessServletTest extends AbstractConfigFlowTest {
assertTrue(website.contains("Pairing failed!"));
assertTrue(website.contains("Missing e-mail address."));
}
@Test
public void whenTheSuccessPageIsRequestedAndAMalformedEmailIsPassedThenTheFailurePageIsShown() throws Exception {
// when:
Website website = getCrawler().doGetRelative("/mielecloud/success?" + SuccessServlet.BRIDGE_UID_PARAMETER_NAME
+ "=" + MieleCloudBindingIntegrationTestConstants.BRIDGE_THING_UID.getAsString() + "&"
+ SuccessServlet.EMAIL_PARAMETER_NAME + "=not:an!email");
// then:
assertTrue(website.contains("Pairing failed!"));
assertTrue(website.contains("Malformed e-mail address."));
}
}

View File

@@ -195,21 +195,6 @@ public class MieleBridgeHandlerTest extends OpenHabOsgiTest {
MieleCloudBindingConstants.I18NKeys.BRIDGE_STATUS_DESCRIPTION_ACCESS_TOKEN_NOT_CONFIGURED);
}
@Test
public void testThingStatusIsSetToOfflineWithDetailConfigurationErrorAndDescriptionWhenTheEmailAddressIsInvalid()
throws Exception {
// given:
getBridge().getConfiguration().setProperties(
Collections.singletonMap(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, "not!a!mail$address"));
// when:
getHandler().initialize();
// then:
assertThingStatusIs(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
MieleCloudBindingConstants.I18NKeys.BRIDGE_STATUS_DESCRIPTION_INVALID_EMAIL);
}
@Test
public void testThingStatusIsSetToOfflineWithDetailConfigurationErrorAndDescriptionWhenTheMieleAccountHasNotBeenAuthorized()
throws Exception {