|
1 | 1 | import pytest |
2 | 2 |
|
| 3 | +import squarecloud |
3 | 4 | from squarecloud.app import Application |
4 | 5 | from tests import GITHUB_ACCESS_TOKEN |
5 | 6 |
|
6 | 7 |
|
7 | 8 | @pytest.mark.asyncio(scope='session') |
8 | 9 | @pytest.mark.app |
9 | 10 | 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 | + |
10 | 14 | async def test_app_data(self, app: Application): |
11 | | - await app.data() |
| 15 | + assert isinstance(await app.data(), squarecloud.AppData) |
12 | 16 |
|
13 | 17 | async def test_app_status(self, app: Application): |
14 | | - await app.status() |
| 18 | + assert isinstance(await app.status(), squarecloud.StatusData) |
15 | 19 |
|
16 | 20 | async def test_app_logs(self, app: Application): |
17 | | - await app.logs() |
| 21 | + assert isinstance(await app.logs(), squarecloud.LogsData) |
18 | 22 |
|
19 | 23 | async def test_app_backup(self, app: Application): |
20 | | - await app.backup() |
| 24 | + assert isinstance(await app.backup(), squarecloud.BackupData) |
21 | 25 |
|
22 | 26 | 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) |
24 | 28 |
|
25 | 29 | async def test_app_last_deploys(self, app: Application): |
26 | | - await app.last_deploys() |
| 30 | + assert isinstance(await app.last_deploys(), list) |
27 | 31 |
|
28 | 32 | @pytest.mark.skipif( |
29 | 33 | lambda app: not app.is_website, |
30 | 34 | reason='application is not website' |
31 | 35 | ) |
32 | 36 | async def test_domain_analytics(self, app: Application): |
33 | | - await app.domain_analytics() |
| 37 | + assert isinstance( |
| 38 | + await app.domain_analytics(), squarecloud.DomainAnalytics |
| 39 | + ) |
34 | 40 |
|
35 | 41 | @pytest.mark.skipif( |
36 | 42 | lambda app: not app.is_website, |
37 | 43 | reason='application is not website' |
38 | 44 | ) |
39 | 45 | 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