Skip to content

Commit

Permalink
Add skeleton test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxuser committed Mar 4, 2021
1 parent 3b6199f commit 8195f04
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ venv/
appconfig*

# Python build artifacts
.eggs/
*.egg-info/
build/
dist/
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ pydantic
httpx
aiortc
construct
dpkt
dpkt

wheel
pytest-runner
pytest
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@
"aiortc",
"construct",
"dpkt"
]
],
setup_requires=[
"wheel",
"pytest-runner"
],
tests_require=["pytest"]
)
13 changes: 13 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from typing import Dict
import os
import pytest

@pytest.fixture(scope='session')
def test_data() -> Dict[str, bytes]:
data = {}
data_path = os.path.join(os.path.dirname(__file__), 'data')
for f in os.listdir(data_path):
with open(os.path.join(data_path, f), 'rb') as fh:
data[f] = fh.read()

return data
Empty file added tests/data/.keep
Empty file.
15 changes: 15 additions & 0 deletions tests/test_appconfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import uuid
import json
from xcloud.common import AppConfiguration

def test_appconfig(test_data: dict):
appconfig = test_data["appconfig_no_tokens.json"].decode('utf-8')
appconfig = json.loads(appconfig)

config = AppConfiguration(**appconfig)

assert config.SigningKey.startswith("-----BEGIN EC PRIVATE KEY-----\nMH")
assert config.WindowsLiveTokens is None
assert config.XalParameters is not None
assert config.ClientUUID == uuid.UUID("78af29d1-7572-4861-9ce2-1cd99830b9e7")
assert config.XalParameters.AppId == "000000004415494b"

0 comments on commit 8195f04

Please sign in to comment.