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
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ on:
branches: [ main, beta ]
types: [ opened, reopened, synchronize ]

env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
ORG_ID: ${{ vars.ORG_ID }}
ORG_NAME: ${{ vars.ORG_NAME }}
TEAM_NAME: ${{ vars.TEAM_NAME }}
NUMBER_OF_MEMBERS: ${{ vars.NUMBER_OF_MEMBERS }}

jobs:
pkg-and-docs:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion masterblaster/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(
self.name: str = name
self.player_id: str = playerId
self.role: int = role
self.added_at: datetime = parser.isoparse(addedAt)
self.added_at: datetime = parser.isoparse(addedAt) if addedAt else None
self.invited_at: Optional[datetime] = (
None if not invitedAt else parser.isoparse(invitedAt)
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_masterblaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async def test_set_access_token_setup():

@pytest.mark.asyncio
async def test_get_all_members():
expected = 11
expected = int(os.getenv("NUMBER_OF_MEMBERS"))
async with MasterBlaster(os.getenv("ACCESS_TOKEN")) as mb:
org = await mb.get_org(os.getenv("ORG_ID"))
members = await org.get_members()
Expand Down
1 change: 1 addition & 0 deletions tests/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@
"useAutoForfeit": False,
"forfeitTimeoutInSeconds": 420,
"customConfigFile": None,
"version": 0,
"plugins": [],
"insecureServer": False,
},
Expand Down
262 changes: 2 additions & 260 deletions tests/test_organisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,238 +60,8 @@
"addedAt": "2000-01-01T00:00:00.00+00:00",
"invitedAt": None,
},
{
"player": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nickName": "name",
"avatarUrl": "",
"registered": "2000-01-01T00:00:00.00+00:00",
"isProfileComplete": True,
"gameAccounts": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nick": "name",
"avatarUrl": "",
"gameId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"isConnected": True,
"connectedAt": "2000-01-01T00:00:00.00+00:00",
}
],
},
"email": "email@email.com",
"name": "name",
"playerId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"role": 10,
"addedAt": "2000-01-01T00:00:00.00+00:00",
"invitedAt": None,
},
{
"player": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nickName": "name",
"avatarUrl": "",
"registered": "2000-01-01T00:00:00.00+00:00",
"isProfileComplete": True,
"gameAccounts": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nick": "name",
"avatarUrl": "",
"gameId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"isConnected": True,
"connectedAt": "2000-01-01T00:00:00.00+00:00",
}
],
},
"email": "email@email.com",
"name": "name",
"playerId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"role": 10,
"addedAt": "2000-01-01T00:00:00.00+00:00",
"invitedAt": None,
},
{
"player": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nickName": "name",
"avatarUrl": "",
"registered": "2000-01-01T00:00:00.00+00:00",
"isProfileComplete": True,
"gameAccounts": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nick": "name",
"avatarUrl": "",
"gameId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"isConnected": True,
"connectedAt": "2000-01-01T00:00:00.00+00:00",
}
],
},
"email": "email@email.com",
"name": "name",
"playerId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"role": 10,
"addedAt": "2000-01-01T00:00:00.00+00:00",
"invitedAt": None,
},
{
"player": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nickName": "name",
"avatarUrl": "",
"registered": "2000-01-01T00:00:00.00+00:00",
"isProfileComplete": True,
"gameAccounts": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nick": "name",
"avatarUrl": "",
"gameId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"isConnected": True,
"connectedAt": "2000-01-01T00:00:00.00+00:00",
}
],
},
"email": "email@email.com",
"name": "name",
"playerId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"role": 10,
"addedAt": "2000-01-01T00:00:00.00+00:00",
"invitedAt": None,
},
{
"player": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nickName": "name",
"avatarUrl": "",
"registered": "2000-01-01T00:00:00.00+00:00",
"isProfileComplete": True,
"gameAccounts": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nick": "name",
"avatarUrl": "",
"gameId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"isConnected": True,
"connectedAt": "2000-01-01T00:00:00.00+00:00",
}
],
},
"email": "email@email.com",
"name": "name",
"playerId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"role": 10,
"addedAt": "2000-01-01T00:00:00.00+00:00",
"invitedAt": None,
},
{
"player": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nickName": "name",
"avatarUrl": "",
"registered": "2000-01-01T00:00:00.00+00:00",
"isProfileComplete": True,
"gameAccounts": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nick": "name",
"avatarUrl": "",
"gameId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"isConnected": True,
"connectedAt": "2000-01-01T00:00:00.00+00:00",
}
],
},
"email": "email@email.com",
"name": "name",
"playerId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"role": 10,
"addedAt": "2000-01-01T00:00:00.00+00:00",
"invitedAt": None,
},
{
"player": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nickName": "name",
"avatarUrl": "",
"registered": "2000-01-01T00:00:00.00+00:00",
"isProfileComplete": True,
"gameAccounts": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nick": "name",
"avatarUrl": "",
"gameId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"isConnected": True,
"connectedAt": "2000-01-01T00:00:00.00+00:00",
}
],
},
"email": "email@email.com",
"name": "name",
"playerId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"role": 10,
"addedAt": "2000-01-01T00:00:00.00+00:00",
"invitedAt": None,
},
{
"player": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nickName": "name",
"avatarUrl": "",
"registered": "2000-01-01T00:00:00.00+00:00",
"isProfileComplete": True,
"gameAccounts": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nick": "name",
"avatarUrl": "",
"gameId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"isConnected": True,
"connectedAt": "2000-01-01T00:00:00.00+00:00",
}
],
},
"email": "email@email.com",
"name": "name",
"playerId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"role": 10,
"addedAt": "2000-01-01T00:00:00.00+00:00",
"invitedAt": None,
},
{
"player": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nickName": "name",
"avatarUrl": "",
"registered": "2000-01-01T00:00:00.00+00:00",
"isProfileComplete": True,
"gameAccounts": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"nick": "name",
"avatarUrl": "",
"gameId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"isConnected": True,
"connectedAt": "2000-01-01T00:00:00.00+00:00",
}
],
},
"email": "email@email.com",
"name": "name",
"playerId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"role": 10,
"addedAt": "2000-01-01T00:00:00.00+00:00",
"invitedAt": None,
},
],
"images": [
{
"imageType": 1,
"imageId": "56d36a7e-30af-4929-a4e2-322d951e5b45",
"originalImageId": "56d36a7e-30af-4929-a4e2-322d951e5b45",
}
],
}

Expand Down Expand Up @@ -369,20 +139,6 @@ async def test_get_teams():
await org.session.close()


@pytest.mark.asyncio
async def test_get_teams_fail():
"""
Masterblaster has kept this endpoint unsecure, this test will fail for now...
"""
org = Organisation(**masterblaster_organisation)
org.session = aiohttp.ClientSession()
try:
with pytest.raises(ValueError):
await org.get_teams()
finally:
await org.session.close()


@pytest.mark.asyncio
async def test_get_images():
expected = masterblaster_organisation["images"]
Expand All @@ -396,24 +152,10 @@ async def test_get_images():
)
org = Organisation(**masterblaster_organisation)
org.session = aiohttp.ClientSession(headers=header)
assert [image.id for image in await org.get_images()] == [
assert len([image.id for image in await org.get_images()]) == len([
image["imageId"] for image in expected
]
])
assert [image.original_id for image in await org.get_images()] == [
image["originalImageId"] for image in expected
]
await org.session.close()


@pytest.mark.asyncio
async def test_get_images_fail():
"""
Masterblaster has kept this endpoint unsecure, this test will fail for now...
"""
org = Organisation(**masterblaster_organisation)
org.session = aiohttp.ClientSession()
try:
with pytest.raises(ValueError):
await org.get_images()
finally:
await org.session.close()