Skip to content

Commit 1bf4967

Browse files
committed
Reactivate charmhub.info not found test
1 parent 5d55af6 commit 1bf4967

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

juju/charmhub.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ async def info(self, name, channel=None):
8484
charmhub_url = await self._charmhub_url()
8585
url = "{}/v2/charms/info/{}?fields=channel-map".format(
8686
charmhub_url.value, name)
87-
_response = self.request_charmhub_with_retry(url, 5)
87+
try:
88+
_response = await self.request_charmhub_with_retry(url, 5)
89+
except JujuError as e:
90+
if '404' in e.message:
91+
raise JujuError(f'{name} not found') from e
8892
result = json.loads(_response.text)
8993
result['channel-map'] = CharmHub._channel_list_to_map(result['channel-map'],
9094
name,

tests/integration/test_charmhub.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
from .. import base
4-
from juju.errors import JujuAPIError, JujuError
4+
from juju.errors import JujuError
55
from juju import jasyncio
66

77

@@ -48,15 +48,11 @@ async def test_info_with_channel(event_loop):
4848

4949
@base.bootstrapped
5050
@pytest.mark.asyncio
51-
@pytest.mark.skip('CharmHub facade no longer exists')
5251
async def test_info_not_found(event_loop):
5352
async with base.CleanModel() as model:
54-
try:
53+
with pytest.raises(JujuError) as err:
5554
await model.charmhub.info("badnameforapp")
56-
except JujuAPIError as e:
57-
assert e.message == "badnameforapp not found"
58-
else:
59-
assert False
55+
assert "badnameforapp not found" in str(err)
6056

6157

6258
@base.bootstrapped

0 commit comments

Comments
 (0)