Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
accept licences in integration tests (#41)
Browse files Browse the repository at this point in the history
* accept licences in integration tests

* requests

* fix url

* cleanup
  • Loading branch information
malmans2 authored Mar 18, 2024
1 parent f776811 commit be352a1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Any

import pytest
import requests


@pytest.fixture
Expand All @@ -12,9 +13,21 @@ def api_root_url() -> str:


@pytest.fixture
def api_key() -> str:
def api_key(api_root_url: str) -> str:
if key := os.getenv("CADS_API_KEY"):
return key

# default to test user 1
return os.getenv("CADS_API_KEY") or "00000000-0000-4000-a000-000000000000"
key = "00000000-0000-4000-a000-000000000000"

# Accept all licences
result = requests.get(f"{api_root_url}/catalogue/v1/vocabularies/licences")
requests.patch(
f"{api_root_url}/profiles/v1/account/licences",
json=result.json(),
headers={"PRIVATE-TOKEN": key},
)
return key


@pytest.fixture
Expand Down

0 comments on commit be352a1

Please sign in to comment.