Skip to content

Commit aa4f931

Browse files
albertsolaCopilot
andcommitted
MPT-19909: add e2e tests for /public/v1/integration/categories
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0d12299 commit aa4f931

5 files changed

Lines changed: 87 additions & 0 deletions

File tree

e2e_config.test.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,6 @@
6767
"notifications.category.id": "NTC-6157-0397",
6868
"notifications.message.id": "MSG-0000-6215-1019-0139",
6969
"notifications.subscriber.id": "NTS-0829-7123-7123",
70+
"integration.category.id": "CAT-0000-0000",
7071
"integration.extension.id": "EXT-4401-0953"
7172
}

tests/e2e/integration/categories/__init__.py

Whitespace-only changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import pytest
2+
3+
4+
@pytest.fixture
5+
def categories_service(mpt_ops):
6+
return mpt_ops.integration.categories
7+
8+
9+
@pytest.fixture
10+
def async_categories_service(async_mpt_ops):
11+
return async_mpt_ops.integration.categories
12+
13+
14+
@pytest.fixture(scope="session")
15+
def category_id(e2e_config):
16+
return e2e_config["integration.category.id"]
17+
18+
19+
@pytest.fixture
20+
def category_data(short_uuid):
21+
return {
22+
"name": f"e2e - please delete {short_uuid}",
23+
"description": "Created by automated E2E tests. Safe to delete.",
24+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import pytest
2+
3+
from tests.e2e.helper import assert_async_service_filter_with_iterate
4+
5+
pytestmark = [
6+
pytest.mark.flaky,
7+
]
8+
9+
10+
@pytest.mark.skip(reason="creates real resources; run manually only")
11+
async def test_async_create_category(async_categories_service, category_data):
12+
result = await async_categories_service.create(category_data)
13+
14+
assert result.name == category_data["name"]
15+
16+
17+
async def test_async_filter_categories(async_categories_service, category_id):
18+
await assert_async_service_filter_with_iterate(
19+
async_categories_service, category_id, None
20+
) # act
21+
22+
23+
@pytest.mark.skip(reason="modifies real resources; run manually only")
24+
async def test_async_update_category(async_categories_service, category_id):
25+
result = await async_categories_service.update(category_id, {"name": "e2e updated"})
26+
27+
assert result.id == category_id
28+
29+
30+
@pytest.mark.skip(reason="deletes real resources; run manually only")
31+
async def test_async_delete_category(async_categories_service, category_id):
32+
await async_categories_service.delete(category_id) # act
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import pytest
2+
3+
from tests.e2e.helper import assert_service_filter_with_iterate
4+
5+
pytestmark = [
6+
pytest.mark.flaky,
7+
]
8+
9+
10+
@pytest.mark.skip(reason="creates real resources; run manually only")
11+
def test_create_category(categories_service, category_data):
12+
result = categories_service.create(category_data)
13+
14+
assert result.name == category_data["name"]
15+
16+
17+
def test_filter_categories(categories_service, category_id):
18+
assert_service_filter_with_iterate(categories_service, category_id, None) # act
19+
20+
21+
@pytest.mark.skip(reason="modifies real resources; run manually only")
22+
def test_update_category(categories_service, category_id):
23+
result = categories_service.update(category_id, {"name": "e2e updated"})
24+
25+
assert result.id == category_id
26+
27+
28+
@pytest.mark.skip(reason="deletes real resources; run manually only")
29+
def test_delete_category(categories_service, category_id):
30+
categories_service.delete(category_id) # act

0 commit comments

Comments
 (0)