Skip to content

Commit

Permalink
Merge branch 'main' into feat-cb-handler
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Dec 9, 2024
2 parents 279ca39 + f2f8d0b commit 248bb15
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 6 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/integrationtests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Integration Tests

on:
- push

jobs:
build:
runs-on: ubuntu-latest
environment:
name: Integration-Tests
url: https://pypi.org/edutap-eu/edutap.wallet_google/
if: github.ref_name == github.event.repository.default_branch
steps:
- uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
with:
python-version: '3.13'
enable-cache: true
cache-dependency-glob: |
pyproject.toml
- name: Install dependencies
run: uv tool install --with "tox-uv,tox-gh-actions" tox
- name: Test with tox
env:
EDUTAP_WALLET_GOOGLE_CREDENTIALS_FILE: /tmp/edutap-wallet-google-credentials.json
EDUTAP_WALLET_GOOGLE_ISSUER_ID: ${{ secrets.ISSUER_ID }}
EDUTAP_WALLET_GOOGLE_INTEGRATION_TEST_PREFIX: ${{ github.run_id }}

run: |
echo "${{ secrets.SERVICE_ACCOUNT_JSON }}" > $EDUTAP_WALLET_GOOGLE_CREDENTIALS_FILE
tox -- -m integration
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI Tests
name: Unit Tests

on:
- push
Expand All @@ -23,4 +23,4 @@ jobs:
- name: Install dependencies
run: uv tool install --with "tox-uv,tox-gh-actions" tox
- name: Test with tox
run: tox
run: tox -- -m "not integration"
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ Issues = "https://github.com/edutap-eu/edutap.wallet_google/issues"
Documentation = "https://docs.edutap.eu/packages/edutap_wallet_google/index.html"

[project.optional-dependencies]
callback = [
"fastapi",
]
test = [
"pytest",
"requests-mock",
Expand Down
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
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ skip_install = false
constrain_package_deps = true

commands =
pytest -m "not integration" {posargs}
pytest {posargs}
extras =
test

Expand Down

0 comments on commit 248bb15

Please sign in to comment.