Skip to content
Merged
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: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ jobs:
timezone: Europe/Brussels
- run: uv run pytest -n 16
env:
API_URL: https://api-staging-eu.seatsio.net
DEMO_COMPANY_SECRET_KEY: ${{ secrets.DEMO_COMPANY_SECRET_KEY }}
CORE_V2_STAGING_EU_SYSTEM_API_SECRET: ${{ secrets.CORE_V2_STAGING_EU_SYSTEM_API_SECRET }}
26 changes: 13 additions & 13 deletions tests/seatsioClientTest.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import os
import time
import unittest
import uuid
import time

import requests

import seatsio
from seatsio.region import Region

BASE_URL = "https://api-staging-eu.seatsio.net"


class SeatsioClientTest(unittest.TestCase):

Expand All @@ -24,21 +22,20 @@ def tearDown(self):
super(SeatsioClientTest, self).tearDown()

def newClient(self, secret_key):
return seatsio.Client(Region(BASE_URL), secret_key)
return seatsio.Client(Region(self.base_url()), secret_key)

def create_test_company(self):
response = requests.post(
url=BASE_URL + "/system/private/create-test-company",
url=self.base_url() + "/system/private/create-test-company",
auth=(self.system_api_secret(), '')
)
if response.ok:
return response.json()
else:
raise Exception("Failed to create a test user")

@staticmethod
def create_client(secret_key, workspace_key):
return seatsio.Client(Region(BASE_URL), secret_key, workspace_key)
def create_client(self, secret_key, workspace_key):
return seatsio.Client(Region(self.base_url()), secret_key, workspace_key)

@staticmethod
def random_email():
Expand Down Expand Up @@ -66,7 +63,7 @@ def create_test_chart_from_file(self, file):
with open(os.path.join(os.path.dirname(__file__), file), 'r') as test_chart_json:
data = test_chart_json.read().replace('\n', '')
chart_key = str(uuid.uuid4())
url = BASE_URL + "/system/public/charts/" + chart_key
url = self.base_url() + "/system/public/charts/" + chart_key
response = requests.post(
url=url,
headers={"Accept": "application/json"},
Expand All @@ -90,10 +87,13 @@ def wait_for_status_changes(self, event, num_status_changes):
else:
return status_changes

def system_api_secret(self):
secret = os.getenv("CORE_V2_STAGING_EU_SYSTEM_API_SECRET")
assert secret, "Missing CORE_V2_STAGING_EU_SYSTEM_API_SECRET"
return secret
@staticmethod
def base_url():
return os.getenv("API_URL") or "http://localhost:9001"

@staticmethod
def system_api_secret():
return os.getenv("CORE_V2_STAGING_EU_SYSTEM_API_SECRET") or "superSecretSystemApi"

def demo_company_secret_key(self):
return os.environ["DEMO_COMPANY_SECRET_KEY"]
Expand Down
Loading