Skip to content

Commit 1a6e4d2

Browse files
committed
Tmp print user id, to see which test user is being used in CI
1 parent 1bce291 commit 1a6e4d2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ We have integration tests which build and run Actors using the Python SDK on the
7878
you need to set the `APIFY_TEST_USER_API_TOKEN` environment variable to the API token of the Apify user you want to
7979
use for the tests, and then start them with `make integration-tests`.
8080

81+
For subset of integration tests another token is needed `APIFY_TEST_USER_2_API_TOKEN`. Such tests are testing
82+
the storage restricted access and thus need two user accounts.
83+
8184
If you want to run the integration tests on a different environment than the main Apify Platform, you need to set
8285
the `APIFY_INTEGRATION_TESTS_API_URL` environment variable to the right URL to the Apify API you want to use.
8386

tests/integration/conftest.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# type:ignore #noqa:PGH003
12
import json
23
import os
34
import secrets
@@ -10,6 +11,7 @@
1011
from apify_client import ApifyClient, ApifyClientAsync
1112

1213
TOKEN_ENV_VAR = 'APIFY_TEST_USER_API_TOKEN'
14+
TOKEN_ENV_VAR_2 = 'APIFY_TEST_USER_2_API_TOKEN'
1315
API_URL_ENV_VAR = 'APIFY_INTEGRATION_TESTS_API_URL'
1416

1517

@@ -30,15 +32,16 @@ def api_token() -> str:
3032
@pytest.fixture(scope='session')
3133
def api_token_2() -> str:
3234
"""API token for the second test user for storage permission tests."""
33-
second_user_env_var = 'APIFY_TEST_USER_PYTHON_SDK_API_TOKEN'
34-
token = os.getenv(second_user_env_var)
35+
token = os.getenv(TOKEN_ENV_VAR_2)
3536
if not token:
36-
raise RuntimeError(f'{second_user_env_var} environment variable is missing, cannot run permission tests!')
37+
raise RuntimeError(f'{TOKEN_ENV_VAR_2} environment variable is missing, cannot run permission tests!')
3738
return token
3839

3940

4041
@pytest.fixture
4142
def apify_client(api_token: str) -> ApifyClient:
43+
client = ApifyClient(api_token, api_url=os.getenv(API_URL_ENV_VAR))
44+
raise Exception(client.user().get()['id']) # noqa:TRY002
4245
return ApifyClient(api_token, api_url=os.getenv(API_URL_ENV_VAR))
4346

4447

0 commit comments

Comments
 (0)