Skip to content

Commit 1a42bcc

Browse files
committed
Move list_secret integration test into test_secrets
1 parent dd9ef6f commit 1a42bcc

2 files changed

Lines changed: 21 additions & 20 deletions

File tree

tests/integration/test_model.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,23 +1273,3 @@ async def test_storage_pools_on_lxd(event_loop):
12731273
await jasyncio.sleep(5)
12741274
pools = await model.list_storage_pools()
12751275
assert "test-pool" not in [p['name'] for p in pools]
1276-
1277-
1278-
# This test can only work if we can fully upgrade the whole charm
1279-
# with the corresponding logic :)
1280-
@base.bootstrapped
1281-
async def test_list_secrets(event_loop):
1282-
"""Use the charm-secret charm definition and see if the
1283-
arguments defined in the secret are correct or not."""
1284-
1285-
charm_path = TESTS_DIR / 'charm-secret/charm-secret_ubuntu-22.04-amd64.charm'
1286-
1287-
async with base.CleanModel() as model:
1288-
await model.deploy(str(charm_path))
1289-
assert 'charm-secret' in model.applications
1290-
await model.wait_for_idle(status="active")
1291-
assert model.units['charm-secret/0'].workload_status == 'active'
1292-
1293-
secrets = await model.list_secrets(show_secrets=True)
1294-
assert secrets is not None
1295-
assert len(secrets.results) == 1

tests/integration/test_secrets.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import pytest
55
from .. import base
6+
from ..utils import TESTS_DIR
67

78

89
@base.bootstrapped
@@ -16,3 +17,23 @@ async def test_add_secret(event_loop):
1617
secrets = await model.list_secrets()
1718
assert len(secrets) == 1
1819
assert secrets[0].label == 'my-apitoken'
20+
21+
22+
# This test can only work if we can fully upgrade the whole charm
23+
# with the corresponding logic :)
24+
@base.bootstrapped
25+
async def test_list_secrets(event_loop):
26+
"""Use the charm-secret charm definition and see if the
27+
arguments defined in the secret are correct or not."""
28+
29+
charm_path = TESTS_DIR / 'charm-secret/charm-secret_ubuntu-22.04-amd64.charm'
30+
31+
async with base.CleanModel() as model:
32+
await model.deploy(str(charm_path))
33+
assert 'charm-secret' in model.applications
34+
await model.wait_for_idle(status="active")
35+
assert model.units['charm-secret/0'].workload_status == 'active'
36+
37+
secrets = await model.list_secrets(show_secrets=True)
38+
assert secrets is not None
39+
assert len(secrets.results) == 1

0 commit comments

Comments
 (0)