tomitribe / beryllium

Apache License 2.0
6 stars 6 forks source link

basic auth? #8

Open sixcorners opened 8 years ago

sixcorners commented 8 years ago

What about a

@Given("^I am using basic authentication with \"([^\"]*)\" username and \"([^\"]*)\" password$")
public void iAmUsingBasicAuthenticationWithUsernameAndPassword(String username, String password) throws Throwable {
    BasicAuthScheme auth = new BasicAuthScheme();
    auth.setUserName(username);
    auth.setPassword(password);
    RestAssured.authentication = auth;
}

step?

cchacin commented 8 years ago

I think we can emulate this with a header:

curl -X GET -H "Authorization: Basic Y2FybG9zOmNhcmxvcw==" "http://localhost:8080/somepath"
sixcorners commented 8 years ago

What about a

@When("^I make a DELETE call to \"([^\"]*)\" endpoint with headers:$")
public void iMakeADELETECallToEndpointWithHeaders(final String endpointUrl, final DataTable headers) throws Throwable {
    final RequestSpecification spec = create()
        .headers(headers.asMap(String.class, String.class));
    execute(spec, "DELETE", endpointUrl);
}

step?

sixcorners commented 8 years ago

Actually.. maybe it would be better if the http verb for the other steps could be changed to arbitrary things?