1010@pytest .mark .bundle
1111async def test_add_secret ():
1212 async with base .CleanModel () as model :
13+ assert model ._info
14+ if str (model ._info .agent_version ) < "3.3.0" :
15+ pytest .skip ("Juju too old, need Secrets API v2" )
16+
1317 secret = await model .add_secret (name = 'my-apitoken' , data_args = ['token=34ae35facd4' ])
1418 assert secret .startswith ('secret:' )
1519
@@ -28,6 +32,10 @@ async def test_list_secrets():
2832 charm_path = TESTS_DIR / 'charm-secret/charm-secret_ubuntu-22.04-amd64.charm'
2933
3034 async with base .CleanModel () as model :
35+ assert model ._info
36+ if str (model ._info .agent_version ) < "3.3.0" :
37+ pytest .skip ("Juju too old, need Secrets API v2" )
38+
3139 await model .deploy (str (charm_path ))
3240 assert 'charm-secret' in model .applications
3341 await model .wait_for_idle (status = "active" )
@@ -42,6 +50,10 @@ async def test_list_secrets():
4250@pytest .mark .bundle
4351async def test_update_secret ():
4452 async with base .CleanModel () as model :
53+ assert model ._info
54+ if str (model ._info .agent_version ) < "3.3.0" :
55+ pytest .skip ("Juju too old, need Secrets API v2" )
56+
4557 secret = await model .add_secret (name = 'my-apitoken' , data_args = ['token=34ae35facd4' ])
4658 assert secret .startswith ('secret:' )
4759
@@ -56,6 +68,10 @@ async def test_update_secret():
5668@pytest .mark .bundle
5769async def test_remove_secret ():
5870 async with base .CleanModel () as model :
71+ assert model ._info
72+ if str (model ._info .agent_version ) < "3.3.0" :
73+ pytest .skip ("Juju too old, need Secrets API v2" )
74+
5975 secret = await model .add_secret (name = 'my-apitoken' , data_args = ['token=34ae35facd4' ])
6076 assert secret .startswith ('secret:' )
6177
@@ -69,6 +85,10 @@ async def test_remove_secret():
6985@pytest .mark .bundle
7086async def test_grant_secret ():
7187 async with base .CleanModel () as model :
88+ assert model ._info
89+ if str (model ._info .agent_version ) < "3.3.0" :
90+ pytest .skip ("Juju too old, need Secrets API v2" )
91+
7292 secret = await model .add_secret (name = 'my-apitoken' , data_args = ['token=34ae35facd4' ])
7393 assert secret .startswith ('secret:' )
7494
@@ -81,6 +101,10 @@ async def test_grant_secret():
81101@pytest .mark .bundle
82102async def test_revoke_secret ():
83103 async with base .CleanModel () as model :
104+ assert model ._info
105+ if str (model ._info .agent_version ) < "3.3.0" :
106+ pytest .skip ("Juju too old, need Secrets API v2" )
107+
84108 secret = await model .add_secret (name = 'my-apitoken' , data_args = ['token=34ae35facd4' ])
85109 assert secret .startswith ('secret:' )
86110 await model .revoke_secret ('my-apitoken' , 'ubuntu' )
0 commit comments