Skip to content

Commit 40d880f

Browse files
committed
Fix e2e tests for api key
1 parent d8c147a commit 40d880f

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

hurl/api_key.hurl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ service: example
2828
expiration: 60
2929
HTTP 200
3030
[Captures]
31-
created_key: xpath "//code[@id='api-key']/text()"
31+
created_key: xpath "string(//code[@id='api-key'])"
3232

3333
# Use created key
3434
GET http://localhost:8080/auth-url/status
35-
[Headers]
3635
X-Original-URL: http://localhost:8081/
3736
X-Api-Key: {{created_key}}
3837
HTTP 200
@@ -45,18 +44,16 @@ session_id: {{session}}
4544
key: {{created_key}}
4645
HTTP 200
4746
[Captures]
48-
rotated_key: xpath "//code[@id='api-key']/text()"
47+
rotated_key: xpath "string(//code[@id='api-key'])"
4948

5049
# Old key should fail
5150
GET http://localhost:8080/auth-url/status
52-
[Headers]
5351
X-Original-URL: http://localhost:8081/
5452
X-Api-Key: {{created_key}}
5553
HTTP 401
5654

5755
# New key should succeed
5856
GET http://localhost:8080/auth-url/status
59-
[Headers]
6057
X-Original-URL: http://localhost:8081/
6158
X-Api-Key: {{rotated_key}}
6259
HTTP 200
@@ -72,7 +69,6 @@ Location: /
7269

7370
# Deleted key should fail
7471
GET http://localhost:8080/auth-url/status
75-
[Headers]
7672
X-Original-URL: http://localhost:8081/
7773
X-Api-Key: {{rotated_key}}
7874
HTTP 401

static/templates/api_key.html.hbs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{{> header }}
22
<div class="relative p-4 w-full max-w-md h-full md:h-auto">
3-
<div class="relative p-4 text-center bg-white rounded-lg shadow-sm dark:bg-gray-800 sm:p-5">
4-
<p class="mb-4 text-md text-gray-900 dark:text-white">Store this API key now. You won't be able to see it again.</p>
5-
<code id="api-key" class="block p-2 bg-gray-100 dark:bg-gray-700 break-words">{{data.key}}</code>
6-
<a href="/" class="py-2 px-3 m-2 text-sm font-medium text-center text-white rounded-lg bg-primary-800 hover:bg-primary-700 focus:ring-4 focus:outline-hidden focus:ring-primary-300 dark:focus:ring-primary-900">Back</a>
7-
</div>
3+
<div class="relative p-4 text-center bg-white rounded-lg shadow-sm dark:bg-gray-800 sm:p-5">
4+
<p class="mb-4 text-md text-gray-900 dark:text-white">Store this API key now. You won't be able to see it again.</p>
5+
<code id="api-key" class="block p-2 bg-gray-100 dark:bg-gray-700 break-words">{{data.key}}</code>
6+
<a href="/" class="py-2 px-3 m-2 text-sm font-medium text-center text-white rounded-lg bg-primary-800 hover:bg-primary-700 focus:ring-4 focus:outline-hidden focus:ring-primary-300 dark:focus:ring-primary-900">Back</a>
7+
</div>
88
</div>
99
{{> footer }}

0 commit comments

Comments
 (0)