Skip to content

Commit 09059dc

Browse files
🧪 update tests
1 parent c62ac7f commit 09059dc

File tree

3 files changed

+31
-14
lines changed

3 files changed

+31
-14
lines changed

tests/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import asyncio
22
import os
3+
from random import choice
4+
from string import ascii_letters
35

46
import pytest
57
from dotenv import load_dotenv
@@ -32,7 +34,8 @@ async def app(client: Client) -> Application:
3234
display_name='normal_test',
3335
main='main.py',
3436
memory=512,
35-
subdomain='bhejbdhjwebjhde',
37+
subdomain=''.join(choice(ascii_letters) for _ in range(8)),
38+
3639
)
3740
with Status('uploading test application...', spinner='point'):
3841
upload_data: UploadData = await client.upload_app(

tests/test_app.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,12 @@ async def test_app_github_integration(self, app: Application):
3636
async def test_app_last_deploys(self, app: Application):
3737
assert isinstance(await app.last_deploys(), list)
3838

39-
@pytest.mark.skipif(
40-
lambda app: not app.is_website, reason='application is not website'
41-
)
4239
async def test_domain_analytics(self, app: Application):
4340
assert isinstance(
4441
await app.domain_analytics(), squarecloud.DomainAnalytics
4542
)
4643

47-
@pytest.mark.skipif(
48-
lambda app: not app.is_website, reason='application is not website'
49-
)
44+
@pytest.mark.skip
5045
async def test_set_custom_domain(self, app: Application):
5146
assert isinstance(await app.set_custom_domain('test.com.br'), str)
5247

tests/test_request_listeners.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -360,20 +360,39 @@ async def test_listener(response: Response):
360360
assert isinstance(expected_result, Response)
361361
assert isinstance(expected_response, Response)
362362

363-
@_clear_listener_on_rerun(Endpoint.dns_records())
364-
async def test_dns_records(self, client: Client, app: Application):
365-
endpoint: Endpoint = Endpoint.dns_records()
366-
expected_result: list[DNSRecord] | None
363+
# @_clear_listener_on_rerun(Endpoint.dns_records())
364+
# @pytest.mark.skipif(
365+
# lambda app: not app.custom,
366+
# reason='app have not custom domain',
367+
# )
368+
# async def test_dns_records(self, client: Client, app: Application):
369+
# endpoint: Endpoint = Endpoint.dns_records()
370+
# expected_result: list[DNSRecord] | None
371+
# expected_response: Response | None = None
372+
#
373+
# @client.on_request(endpoint)
374+
# async def test_listener(response: Response):
375+
# nonlocal expected_response
376+
# expected_response = response
377+
#
378+
# expected_result = await client.dns_records(app.id)
379+
# assert isinstance(expected_result, list)
380+
# assert isinstance(expected_result[0], DNSRecord)
381+
# assert isinstance(expected_response, Response)
382+
383+
@_clear_listener_on_rerun(Endpoint.current_integration())
384+
async def test_current(self, client: Client, app: Application):
385+
endpoint: Endpoint = Endpoint.current_integration()
386+
expected_result: str | None
367387
expected_response: Response | None = None
368388

369389
@client.on_request(endpoint)
370390
async def test_listener(response: Response):
371391
nonlocal expected_response
372392
expected_response = response
373393

374-
expected_result = await client.dns_records(app.id)
375-
assert isinstance(expected_result, list)
376-
assert isinstance(expected_result[0], DNSRecord)
394+
expected_result = await client.current_app_integration(app.id)
395+
assert isinstance(expected_result, str)
377396
assert isinstance(expected_response, Response)
378397

379398
@_clear_listener_on_rerun(endpoint=Endpoint.app_status())

0 commit comments

Comments
 (0)