diff --git a/tests/api_tests.py b/tests/api_tests.py index f97d10bb..5e5d6825 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -122,6 +122,26 @@ class TestApiCalls(unittest.TestCase): # get the 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 def test_list_projects(self): """ diff --git a/tests/fixtures/staging-project-meta.xml b/tests/fixtures/staging-project-meta.xml new file mode 100644 index 00000000..b90a726a --- /dev/null +++ b/tests/fixtures/staging-project-meta.xml @@ -0,0 +1,27 @@ + + Staging project "openSUSE:Factory:Staging:test" + requests: +- {id: '123', package: test-package} + + + + + + + + + + + + + + + i586 + x86_64 + + + + x86_64 + i586 + +