diff --git a/.gitignore b/.gitignore index c709f350..b4e27e9d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *~ *.pyc +*.html .*.swp diff --git a/stagingapi.py b/stagingapi.py index 1caeb979..e8da653a 100644 --- a/stagingapi.py +++ b/stagingapi.py @@ -207,6 +207,7 @@ class StagingApi(object): # * removed linked packages try: data = yaml.load(description.text) + data['requests'] except: data = yaml.load('requests: []') return data diff --git a/tests/api_tests.py b/tests/api_tests.py index c19a9d3d..457a4927 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -125,18 +125,23 @@ class TestApiCalls(unittest.TestCase): rq = { 'id': '123', 'package': 'test-package' } # Initiate the pretty overrides - self._register_pretty_url_get('http://localhost/source/openSUSE:Factory:Staging:test/_meta', + self._register_pretty_url_get('http://localhost/source/openSUSE:Factory:Staging:test1/_meta', 'staging-project-meta.xml') + self._register_pretty_url_get('http://localhost/source/openSUSE:Factory:Staging:test2/_meta', + 'staging-project-broken-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.get_prj_pseudometa('openSUSE:Factory:Staging:test') + data = api.get_prj_pseudometa('openSUSE:Factory:Staging:test1') for i in rq.keys(): self.assertEqual(rq[i],data['requests'][0][i]) + data = api.get_prj_pseudometa('openSUSE:Factory:Staging:test2') + self.assertEqual(len(data['requests']),0) + @httpretty.activate def test_list_projects(self): """ diff --git a/tests/fixtures/staging-project-broken-meta.xml b/tests/fixtures/staging-project-broken-meta.xml new file mode 100644 index 00000000..4e6f7510 --- /dev/null +++ b/tests/fixtures/staging-project-broken-meta.xml @@ -0,0 +1,26 @@ + + Staging project "openSUSE:Factory:Staging:test" + + + + + + + + + + + + + + + + i586 + x86_64 + + + + x86_64 + i586 + +