day 7: Authentication and Authorization

This commit is contained in:
Sami 2024-10-15 03:15:51 -04:00
parent e93f401684
commit fc3dfdfd48
2 changed files with 12 additions and 4 deletions

View File

@ -6,11 +6,8 @@
<artifactId>restAssured</artifactId> <artifactId>restAssured</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>restAssured</name> <name>restAssured</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>8</maven.compiler.target>

View File

@ -74,8 +74,19 @@ public class AuthenticationTest {
@Test(priority = 7) @Test(priority = 7)
void testAPIKeyAuth() { void testAPIKeyAuth() {
/* THIS METHOD 1
given().queryParam("appid", "53f8437943998c07789a6693aec69607") given().queryParam("appid", "53f8437943998c07789a6693aec69607")
.when().get("https://api.openweathermap.org/data/2.5/weather?q=Chicago&appid=53f8437943998c07789a6693aec69607") .when().get("https://api.openweathermap.org/data/2.5/weather?q=New York&appid=53f8437943998c07789a6693aec69607")
.then().statusCode(200).log().all(); .then().statusCode(200).log().all();
*/
//METHOD 2
given()
.pathParam("myPath", "data/2.5/weather")
.queryParam("q", "New York")
.queryParam("appid", "53f8437943998c07789a6693aec69607")
.when()
.get("https://api.openweathermap.org/{myPath}")
.then().statusCode(200).log().all();
} }
} }