day 7: Authentication and Authorization #1
@ -51,13 +51,23 @@ public class AuthenticationTest {
|
||||
.then().statusCode(200).log().all();
|
||||
}
|
||||
|
||||
@Test(priority = 5)
|
||||
// @Test(priority = 5)
|
||||
void testOAuth1Auth() {
|
||||
System.out.println("Starting the authenticantion using OAuth1 auth");
|
||||
String bearerToken = "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";
|
||||
given()
|
||||
.auth().oauth("consumerKey", "consumerSecret", "accessToken", "tokenSecret")
|
||||
.when()
|
||||
.get("https://api.github.com/user/repos")
|
||||
.then().statusCode(200).log().all();
|
||||
}
|
||||
|
||||
given().headers("Authorization", "Bearer " + bearerToken)
|
||||
.when().get("https://api.github.com/user/repos")
|
||||
@Test(priority = 6)
|
||||
void testOAuth2Auth() {
|
||||
System.out.println("Starting the authenticantion using OAuth2 auth");
|
||||
given()
|
||||
.auth().oauth2("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")
|
||||
.when()
|
||||
.get("https://api.github.com/user/repos")
|
||||
.then().statusCode(200).log().all();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user