Skip to content

Commit

Permalink
Add integration_test_id pytest fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
rnixx committed Dec 9, 2024
1 parent 770322b commit 39f93ca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
15 changes: 15 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from pathlib import Path

import copy
import datetime
import json
import os
import pytest
import socket
import typing


Expand Down Expand Up @@ -60,3 +63,15 @@ def _load_mock_request_response(
return data

yield _load_mock_request_response


@pytest.fixture
def integration_test_id():
prefix = os.environ.get(
"EDUTAP_WALLET_GOOGLE_INTEGRATION_TEST_PREFIX",
socket.gethostname()
)
timestamp = datetime.datetime.now(
datetime.timezone.utc
).strftime("%Y-%m-%d_%H-%M-%S_%f")
yield f"{prefix}.{timestamp}"
5 changes: 2 additions & 3 deletions tests/integration/test_create_class.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest
import uuid


text_modules_data = [
Expand Down Expand Up @@ -45,12 +44,12 @@

@pytest.mark.integration
@pytest.mark.parametrize("class_type,class_data", params_for_create)
def test_class_creation(class_type, class_data):
def test_class_creation(class_type, class_data, integration_test_id):
from edutap.wallet_google.api import create
from edutap.wallet_google.api import session_manager

class_data["id"] = (
f"{session_manager.settings.issuer_id}.{uuid.uuid4()}.test.wallet_google.edutap"
f"{session_manager.settings.issuer_id}.{integration_test_id}.test_class_creation.wallet_google.edutap"
)
result = create(class_type, class_data)
assert result is not None

0 comments on commit 39f93ca

Please sign in to comment.