Skip to content

Commit c2379aa

Browse files
Remove tracked __pycache__ and apply .gitignore rules
1 parent 2c36240 commit c2379aa

File tree

12 files changed

+91
-45
lines changed

12 files changed

+91
-45
lines changed

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
pythonpath =
3+
tests/e2e-tests

tests/.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ node_modules/
99
/target
1010
/playwright/.auth/
1111
/allure-report
12-
/e2e-tests/.pytest_cache
13-
/e2e-tests/__pycache__/
14-
/e2e-tests/_lib/_pycache__/
12+
*/__pycache__/
13+
**/__pycache__/
14+
*.pyc

tests/e2e-tests/api/authentication/__init__.py

Whitespace-only changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import requests
2+
import pytest
3+
from lib.constants import METHODS, VALID_ENDPOINTS
4+
from lib.fixtures import *
5+
6+
@pytest.mark.test
7+
@pytest.mark.devtest
8+
@pytest.mark.inttest
9+
@pytest.mark.prodtest
10+
@pytest.mark.parametrize("method", METHODS)
11+
@pytest.mark.parametrize("endpoints", VALID_ENDPOINTS)
12+
def test_401_invalid(url, method, endpoints):
13+
14+
resp = getattr(requests, method)(f"{url}{endpoints}", headers={
15+
"Authorization": "invalid",
16+
})
17+
18+
assert(resp.status_code == 401)
19+
20+
@pytest.mark.test
21+
@pytest.mark.nhsd_apim_authorization({"access": "application", "level": "level0"})
22+
@pytest.mark.parametrize("method", METHODS)
23+
@pytest.mark.parametrize("endpoints", VALID_ENDPOINTS)
24+
def test_401_invalid_level(nhsd_apim_proxy_url, nhsd_apim_auth_headers, method, endpoints):
25+
print(nhsd_apim_proxy_url)
26+
27+
resp = getattr(requests, method)(f"{nhsd_apim_proxy_url}{endpoints}", headers={
28+
**nhsd_apim_auth_headers
29+
})
30+
31+
print("Status:", resp.status_code)
32+
33+
assert(resp.status_code == 401)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import requests
2+
import pytest
3+
from lib.constants import VALID_ENDPOINTS
4+
5+
METHODS = ["get", "post"]
6+
CORRELATION_IDS = [None, "76491414-d0cf-4655-ae20-a4d1368472f3"]
7+
8+
9+
@pytest.mark.test
10+
@pytest.mark.nhsd_apim_authorization({"access": "application", "level": "level0"})
11+
@pytest.mark.parametrize("method", METHODS)
12+
@pytest.mark.parametrize("endpoints", VALID_ENDPOINTS)
13+
def test_user_token_get(nhsd_apim_proxy_url, nhsd_apim_auth_headers, method, endpoints):
14+
print(nhsd_apim_proxy_url)
15+
16+
resp = getattr(requests, method)(f"{nhsd_apim_proxy_url}{endpoints}", headers={
17+
**nhsd_apim_auth_headers
18+
})
19+
20+
print("Status:", resp.status_code)
21+
22+
assert(resp.status_code == 401)

tests/e2e-tests/authentication/test-401-errors.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/e2e-tests/lib/__init__.py

Whitespace-only changes.

tests/e2e-tests/lib/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
VALID_ENDPOINTS = ["/letters", "/mi"]
2-
METHODS = ["get", "post", "patch", "head"]
1+
VALID_ENDPOINTS = ["/letters"]
2+
METHODS = ["get", "post"]

0 commit comments

Comments
 (0)