From be05e06a96576dac2374465637bb7380e723ef1f Mon Sep 17 00:00:00 2001 From: Sami Date: Sat, 12 Oct 2024 02:36:38 -0400 Subject: [PATCH] day 7: Authentication and Authorization --- .../DaySeven/AuthenticationTest.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/test/java/zacksolutions/DaySeven/AuthenticationTest.java b/src/test/java/zacksolutions/DaySeven/AuthenticationTest.java index cd7aab2..df17c90 100644 --- a/src/test/java/zacksolutions/DaySeven/AuthenticationTest.java +++ b/src/test/java/zacksolutions/DaySeven/AuthenticationTest.java @@ -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(); } }