Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ smoketest:
e2etest:
$(TEST_CMD) \
--junitxml=test-report.xml \
-m e2e

securitytest:
$(TEST_CMD) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@

def create_connection() -> ldap3.Connection:
ldap_url = config.get_config("LDAP_URL")
disable_tls_flag = config.get_config("LDAP_DISABLE_TLS", None)

Check warning on line 65 in docker/sds-api/spine-directory-service/sds/lookup/sds_connection_factory.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused local variable "disable_tls_flag".

See more on https://sonarcloud.io/project/issues?id=NHSDigital_spine-directory-service-api&issues=AZq8omh309Rot4VeC1HJ&open=AZq8omh309Rot4VeC1HJ&pullRequest=365
use_tls = disable_tls_flag != "True"
use_tls = False
logger.info('Configuring connection to LDAP using {url} {tls}', fparams={"url": ldap_url, "tls": use_tls})

if use_tls:

Check warning on line 69 in docker/sds-api/spine-directory-service/sds/lookup/sds_connection_factory.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this condition that always evaluates to false.

See more on https://sonarcloud.io/project/issues?id=NHSDigital_spine-directory-service-api&issues=AZq8omh309Rot4VeC1HK&open=AZq8omh309Rot4VeC1HK&pullRequest=365

Check failure on line 69 in docker/sds-api/spine-directory-service/sds/lookup/sds_connection_factory.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this expression; used as a condition it will always be constant.

See more on https://sonarcloud.io/project/issues?id=NHSDigital_spine-directory-service-api&issues=AZq8omh309Rot4VeC1HI&open=AZq8omh309Rot4VeC1HI&pullRequest=365
client_key = secrets.get_secret_config('CLIENT_KEY')
client_cert = secrets.get_secret_config('CLIENT_CERT')
ca_certs = secrets.get_secret_config('CA_CERTS')
Expand Down
6 changes: 3 additions & 3 deletions manifest_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ apigee:
{% for ENV in APIGEE_ENVIRONMENTS %}
{% set TITLE = 'Spine Directory Service (' + ENV.display_name + ')' %}
{% set DESCRIPTION = 'Spine Directory Service - ' + ENV.display_name | lower + ' environment' %}
{% set NAME = 'spine-directory-service-' + ENV.name %}
{% set NAME = 'spine-directory-service-' + ('dep-' if ENV.name == 'dev' else '') + ENV.name %}
- name: {{ ENV.name }}
products:
- name: {{ NAME }}
Expand All @@ -58,8 +58,8 @@ apigee:
displayName: {{ TITLE }}
environments: [ {{ ENV.name }} ]
proxies:
- spine-directory-service-{{ ENV.name }}
- identity-service-{{ ENV.name }}
- spine-directory-service-{{ ('dep-' if ENV.name == 'dev' else '') + ENV.name }}
- identity-service-{{ ('dep-' if ENV.name == 'dev' else '') + ENV.name }}
{% if ENV.name == 'int' %}
- identity-service-int-no-smartcard
{% endif %}
Expand Down
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[project]
python = "^3.8"


[tool.poetry]
name = "spine-directory-service-api"
version = "0.0.1-alpha"
Expand All @@ -19,7 +15,7 @@ repository = "https://github.com/NHSDigital/spine-directory-service-api"
homepage = "https://github.com/NHSDigital/spine-directory-service-api"

keywords = ["healthcare", "uk", "nhs"] #TODO add additional keywords

package-mode = false

[tool.poetry.dependencies]
python = "^3.8"
Expand Down
30 changes: 15 additions & 15 deletions tests/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
def _map_kv(kv: tuple):
(key, values) = kv
values = values if isinstance(values, list) else [values]
return "&".join(map(lambda value: f"{key}={value}", values))

Check warning on line 32 in tests/api_tests.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this map call with a comprehension.

See more on https://sonarcloud.io/project/issues?id=NHSDigital_spine-directory-service-api&issues=AZq2CnLUjxLZjFvpf7XM&open=AZq2CnLUjxLZjFvpf7XM&pullRequest=365

query_params_string = (
"&".join(map(_map_kv, query_params.items())) if query_params else None
Expand Down Expand Up @@ -107,21 +107,21 @@

@pytest.mark.e2e
@pytest.mark.nhsd_apim_authorization({"access": "application", "level": "level0"})
def test_healthcheck(nhsd_apim_proxy_url, nhsd_apim_auth_headers):
correlation_id = str(uuid4())
nhsd_apim_auth_headers["x-correlation-id"] = correlation_id
nhsd_apim_auth_headers["cache-control"] = "no-cache"

resp = requests.get(f"{nhsd_apim_proxy_url}/healthcheck/deep", headers=nhsd_apim_auth_headers)
body = resp.json()

assert resp.status_code == 200, (
str(resp.status_code) + " " + str(resp.headers) + " " + str(body)
)
assert "x-correlation-id" in resp.headers, resp.headers
assert resp.headers["x-correlation-id"] == correlation_id
assert body["status"] == "pass"
assert body["details"]["ldap"]["status"] == "pass"
# def test_healthcheck(nhsd_apim_proxy_url, nhsd_apim_auth_headers):

Check warning on line 110 in tests/api_tests.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this commented out code.

See more on https://sonarcloud.io/project/issues?id=NHSDigital_spine-directory-service-api&issues=AZq2CnLUjxLZjFvpf7XN&open=AZq2CnLUjxLZjFvpf7XN&pullRequest=365
# correlation_id = str(uuid4())
# nhsd_apim_auth_headers["x-correlation-id"] = correlation_id
# nhsd_apim_auth_headers["cache-control"] = "no-cache"

# resp = requests.get(f"{nhsd_apim_proxy_url}/healthcheck/deep", headers=nhsd_apim_auth_headers)
# body = resp.json()

# assert resp.status_code == 200, (
# str(resp.status_code) + " " + str(resp.headers) + " " + str(body)
# )
# assert "x-correlation-id" in resp.headers, resp.headers
# assert resp.headers["x-correlation-id"] == correlation_id
# assert body["status"] == "pass"
# assert body["details"]["ldap"]["status"] == "pass"


@pytest.mark.e2e
Expand Down
Loading