Skip to content

Commit

Permalink
Merge pull request #1348 from grycap/devel
Browse files Browse the repository at this point in the history
Add test
  • Loading branch information
micafer authored Mar 23, 2022
2 parents f607564 + e737054 commit 1a33dea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
Expand Up @@ -698,4 +698,6 @@ IM 1.11.0:
* Enable to get Ansible task output at TOSCA output value.
* Support for specifying the remote cidr in the public security group.
* Fix error in EGI connector using appdb image url without setting site name.
* Fix error getting project ids from AppDB.


10 changes: 10 additions & 0 deletions test/unit/AppDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def get_response(self, method, url, verify, cert=None, headers=None, data=None):
resp.status_code = 200
resp.text = """<appdb:appdb>
<virtualization:provider id="8015G0" in_production="true">
<provider:shares>
<vo:vo id="1" projectid="projectid1">ops</vo:vo>
<vo:vo id="2" projectid="projectid2">vo.access.egi.eu</vo:vo>
</provider:shares>
<provider:url>
http://cloud.recas.ba.infn.it:8787/occi/?image=303d8324-69a7-4372-be24-1d68703affd7
</provider:url>
Expand Down Expand Up @@ -127,3 +131,9 @@ def test_get_image_data(self, requests):
site='cloud.recas.ba.infn.it')
self.assertEqual(site_url, "https://cloud.recas.ba.infn.it:5000")
self.assertEqual(image_id, "image_id2")

@patch('requests.request')
def test_get_project_ids(self, requests):
requests.side_effect = self.get_response
projects = AppDB.get_project_ids('8015G0')
self.assertEqual(projects, {'ops': 'projectid1', 'vo.access.egi.eu': 'projectid2'})

0 comments on commit 1a33dea

Please sign in to comment.