Test metadata in description

This commit is contained in:
Michal Hrusecky 2014-02-10 14:25:31 +01:00 committed by Michal Hrusecky
parent cfd669907d
commit 14d29ca429
2 changed files with 47 additions and 0 deletions

View File

@ -122,6 +122,26 @@ class TestApiCalls(unittest.TestCase):
# get the open requests # get the open requests
requests = api.dispatch_open_requests() requests = api.dispatch_open_requests()
@httpretty.activate
def test_pseudometa_get_prj(self):
"""
Test getting project metadata from YAML in project description
"""
rq = { 'id': '123', 'package': 'test-package' }
# Initiate the pretty overrides
self._register_pretty_url_get('http://localhost/source/openSUSE:Factory:Staging:test/_meta',
'staging-project-meta.xml')
# Initiate the api with mocked rings
with mock_generate_ring_packages():
api = oscs.StagingApi('http://localhost')
# Ensure the output is equal to what we expect
data = api.pseudometa_get_prj('openSUSE:Factory:Staging:test')
for i in rq.keys():
self.assertEqual(rq[i],data['requests'][0][i])
@httpretty.activate @httpretty.activate
def test_list_projects(self): def test_list_projects(self):
""" """

27
tests/fixtures/staging-project-meta.xml vendored Normal file
View File

@ -0,0 +1,27 @@
<project name="openSUSE:Factory:Staging:test">
<title>Staging project "openSUSE:Factory:Staging:test"</title>
<description>requests:
- {id: '123', package: test-package}
</description>
<link project="openSUSE:Factory"/>
<person userid="Admin" role="maintainer"/>
<build>
<enable/>
</build>
<publish>
<disable/>
</publish>
<debuginfo>
<enable/>
</debuginfo>
<repository name="standard" rebuild="direct" linkedbuild="all">
<path project="openSUSE:Factory:Build" repository="standard"/>
<arch>i586</arch>
<arch>x86_64</arch>
</repository>
<repository name="images" rebuild="direct" linkedbuild="all">
<path project="openSUSE:Factory" repository="standard"/>
<arch>x86_64</arch>
<arch>i586</arch>
</repository>
</project>