Skip to content

Commit 9392828

Browse files
committed
tests: moved e2e according to user type
1 parent ece2d63 commit 9392828

19 files changed

+52
-25
lines changed

.github/workflows/e2e_tests.yml

+15-2
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,11 @@ jobs:
251251
shell: bash
252252
run: echo "KILI_SDK_VERSION=$(python -c "from kili import __version__; print(__version__)")" >> $GITHUB_ENV
253253

254-
- name: E2E tests
254+
- name: E2E tests (org admin)
255255
id: e2e
256256
if: github.event.inputs.runE2ETests != 'false'
257257
timeout-minutes: 60
258-
run: pytest --timeout=600 -ra -sv --color yes --code-highlight yes --durations=0 -vv --ignore tests/e2e/test_notebooks.py tests/e2e
258+
run: pytest --timeout=600 -ra -sv --color yes --code-highlight yes --durations=0 -vv tests/e2e/org_admin
259259
env:
260260
KILI_API_CLOUD_VISION: ${{ secrets.KILI_API_CLOUD_VISION }}
261261
KILI_API_ENDPOINT: ${{ env.KILI_API_ENDPOINT }}
@@ -264,6 +264,19 @@ jobs:
264264
KILI_USER_ID: ${{ secrets[format('KILI_USER_ID_{0}', env.TEST_AGAINST)] }}
265265
KILI_TEST_DATA_INTEGRATION_ID: ${{ secrets.KILI_TEST_DATA_INTEGRATION_ID }}
266266

267+
- name: E2E tests (org user)
268+
id: e2e_user
269+
if: github.event.inputs.runE2ETests != 'false'
270+
timeout-minutes: 60
271+
run: pytest --timeout=600 -ra -sv --color yes --code-highlight yes --durations=0 -vv tests/e2e/org_user
272+
env:
273+
KILI_API_CLOUD_VISION: ${{ secrets.KILI_API_CLOUD_VISION }}
274+
KILI_API_ENDPOINT: ${{ env.KILI_API_ENDPOINT }}
275+
KILI_API_KEY: ${{ secrets[format('KILI_USER_API_KEY_{0}_USER', env.TEST_AGAINST)] }}
276+
KILI_USER_EMAIL: ${{ secrets[format('KILI_USER_EMAIL_{0}', env.TEST_AGAINST)] }}
277+
KILI_USER_ID: ${{ secrets[format('KILI_USER_ID_{0}', env.TEST_AGAINST)] }}
278+
KILI_TEST_DATA_INTEGRATION_ID: ${{ secrets.KILI_TEST_DATA_INTEGRATION_ID }}
279+
267280
- name: Notebook tests
268281
# we don't run notebook tests on push to main
269282
# we run regardless of the outcome of the e2e tests

tests/e2e/org_admin/test_tags.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import uuid
2+
3+
import pytest
4+
5+
from kili.client import Kili
6+
7+
8+
@pytest.fixture()
9+
def project_id(kili: Kili):
10+
project_id = kili.create_project(
11+
input_type="TEXT", json_interface={"jobs": {}}, title="test_tags.py e2e admin SDK"
12+
)["id"]
13+
14+
yield project_id
15+
16+
kili.delete_project(project_id)
17+
18+
19+
def test_given_org_with_tags_when_i_update_tag_then_it_is_updated(kili: Kili):
20+
# Given
21+
org_tags = kili.tags(fields=("label",))
22+
assert len(org_tags) > 0, "Organization has no tags"
23+
tag_to_update = next(tag for tag in org_tags if tag["label"])
24+
prev_tag_name = tag_to_update["label"]
25+
26+
# When
27+
new_tag_name = str(uuid.uuid4())
28+
kili.update_tag(tag_name=prev_tag_name, new_tag_name=new_tag_name)
29+
30+
# Then
31+
org_tags = kili.tags(fields=("label",))
32+
assert len(org_tags) > 0, "Organization has no tags"
33+
assert new_tag_name in [tag["label"] for tag in org_tags]
34+
35+
# Cleanup
36+
kili.update_tag(tag_name=new_tag_name, new_tag_name=prev_tag_name)
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/e2e/test_tags.py renamed to tests/e2e/org_user/test_tags.py

+1-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import uuid
2-
31
import pytest
42

53
from kili.client import Kili
@@ -8,7 +6,7 @@
86
@pytest.fixture()
97
def project_id(kili: Kili):
108
project_id = kili.create_project(
11-
input_type="TEXT", json_interface={"jobs": {}}, title="test_tags.py e2e SDK"
9+
input_type="TEXT", json_interface={"jobs": {}}, title="test_tags.py e2e user SDK"
1210
)["id"]
1311

1412
yield project_id
@@ -60,23 +58,3 @@ def test_given_project_with_tags_when_i_call_untag_project_then_it_removes_one_t
6058
nb_tags_in_project_after = len(project_tags)
6159
assert nb_tags_in_project_after == nb_tags_in_project_before - 1
6260
assert not any(tag["label"] == tag_to_delete for tag in project_tags)
63-
64-
65-
def test_given_org_with_tags_when_i_update_tag_then_it_is_updated(kili: Kili):
66-
# Given
67-
org_tags = kili.tags(fields=("label",))
68-
assert len(org_tags) > 0, "Organization has no tags"
69-
tag_to_update = next(tag for tag in org_tags if tag["label"])
70-
prev_tag_name = tag_to_update["label"]
71-
72-
# When
73-
new_tag_name = str(uuid.uuid4())
74-
kili.update_tag(tag_name=prev_tag_name, new_tag_name=new_tag_name)
75-
76-
# Then
77-
org_tags = kili.tags(fields=("label",))
78-
assert len(org_tags) > 0, "Organization has no tags"
79-
assert new_tag_name in [tag["label"] for tag in org_tags]
80-
81-
# Cleanup
82-
kili.update_tag(tag_name=new_tag_name, new_tag_name=prev_tag_name)

0 commit comments

Comments
 (0)