Skip to content

Commit b872367

Browse files
🧪 Add imports and assertions in test_app.py to check the return types of various methods
1 parent 8103c00 commit b872367

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tests/test_app.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,46 @@
11
import pytest
22

3+
import squarecloud
34
from squarecloud.app import Application
45
from tests import GITHUB_ACCESS_TOKEN
56

67

78
@pytest.mark.asyncio(scope='session')
89
@pytest.mark.app
910
class TestApp:
11+
async def test_magic_methods(self, app: Application):
12+
assert app.__repr__() == f'<{Application.__name__} tag={app.name} id={app.id}>'
13+
1014
async def test_app_data(self, app: Application):
11-
await app.data()
15+
assert isinstance(await app.data(), squarecloud.AppData)
1216

1317
async def test_app_status(self, app: Application):
14-
await app.status()
18+
assert isinstance(await app.status(), squarecloud.StatusData)
1519

1620
async def test_app_logs(self, app: Application):
17-
await app.logs()
21+
assert isinstance(await app.logs(), squarecloud.LogsData)
1822

1923
async def test_app_backup(self, app: Application):
20-
await app.backup()
24+
assert isinstance(await app.backup(), squarecloud.BackupData)
2125

2226
async def test_app_github_integration(self, app: Application):
23-
await app.github_integration(GITHUB_ACCESS_TOKEN)
27+
assert isinstance(await app.github_integration(GITHUB_ACCESS_TOKEN), str)
2428

2529
async def test_app_last_deploys(self, app: Application):
26-
await app.last_deploys()
30+
assert isinstance(await app.last_deploys(), list)
2731

2832
@pytest.mark.skipif(
2933
lambda app: not app.is_website,
3034
reason='application is not website'
3135
)
3236
async def test_domain_analytics(self, app: Application):
33-
await app.domain_analytics()
37+
assert isinstance(
38+
await app.domain_analytics(), squarecloud.DomainAnalytics
39+
)
3440

3541
@pytest.mark.skipif(
3642
lambda app: not app.is_website,
3743
reason='application is not website'
3844
)
3945
async def test_set_custom_domain(self, app: Application):
40-
await app.set_custom_domain('test.com.br')
46+
assert isinstance(await app.set_custom_domain('test.com.br'), str)

0 commit comments

Comments
 (0)