fix the test suite for the subpkg tests

actually the biggest impact has my refusal to select into outdated prjs
This commit is contained in:
Stephan Kulow
2014-06-17 14:39:51 +02:00
parent 9579595e72
commit 4b432b9bb1
4 changed files with 26 additions and 13 deletions

1
tests/fixtures/source/home:Admin/gcc vendored Symbolic link
View File

@@ -0,0 +1 @@
wine

1
tests/fixtures/source/home:Admin/puppet vendored Symbolic link
View File

@@ -0,0 +1 @@
wine

View File

@@ -216,7 +216,13 @@ class OBS(object):
'rev': '1',
'vrev': '1',
'name': 'wine',
'srcmd5': 'de7a9f5e3bedb01980465f3be3d236cb',
'srcmd5': 'de9a9f5e3bedb01980465f3be3d236cb',
},
'home:Admin/puppet': {
'rev': '1',
'vrev': '1',
'name': 'puppet',
'srcmd5': 'de8a9f5e3bedb01980465f3be3d236cb',
},
'openSUSE:Factory/gcc': {
'rev': '1',
@@ -478,7 +484,7 @@ class OBS(object):
return response
@GET(re.compile(r'/source/home:Admin/wine'))
@GET(re.compile(r'/source/home:Admin/\w+'))
def source_project(self, request, uri, headers):
"""Return information of a source package."""
package = re.search(r'/source/([\w:]+/\w+)', uri).group(1)
@@ -491,10 +497,15 @@ class OBS(object):
print uri, e
if DEBUG:
print 'SOURCE HOME:ADMIN WINE', uri, response
print 'SOURCE HOME:ADMIN', package, uri, response
return response
@POST(re.compile(r'/source/openSUSE:Factory:Rings:1-MinimalX/\w+'))
def show_wine_link(self, request, uri, headers):
# TODO: only useful answer if cmd=showlinked
return (200, headers, '<collection/>')
@GET('/source/openSUSE:Factory:Staging:A/wine')
def source_link(self, request, uri, headers):
project_package = re.search(r'/source/([\w:]+/\w+)', uri).group(1)
@@ -511,7 +522,7 @@ class OBS(object):
return response
@PUT('/source/openSUSE:Factory:Staging:A/wine/_link')
@PUT(re.compile(r'/source/openSUSE:Factory:Staging:[AB]/\w+/_link'))
def put_source_link(self, request, uri, headers):
"""Create wine link in staging project A."""
project_package = re.search(r'/source/([\w:]+/\w+)/_link', uri).group(1)

View File

@@ -27,17 +27,17 @@ class TestSelect(unittest.TestCase):
def test_old_frozen(self):
self.assertEqual(self.api.prj_frozen_enough('openSUSE:Factory:Staging:A'), False)
self.assertEqual(True, SelectCommand(self.api).perform('openSUSE:Factory:Staging:A', ['gcc']))
self.assertEqual(self.api.prj_frozen_enough('openSUSE:Factory:Staging:A'), True)
# check it won't allow selecting
self.assertEqual(False, SelectCommand(self.api).perform('openSUSE:Factory:Staging:A', ['gcc']))
def test_select_comments(self):
c_api = CommentAPI(self.api.apiurl)
staging_a = 'openSUSE:Factory:Staging:A'
comments = c_api.get_comments(project_name=staging_a)
staging_b = 'openSUSE:Factory:Staging:B'
comments = c_api.get_comments(project_name=staging_b)
# First select
self.assertEqual(True, SelectCommand(self.api).perform(staging_a, ['gcc', 'wine']))
first_select_comments = c_api.get_comments(project_name=staging_a)
self.assertEqual(True, SelectCommand(self.api).perform(staging_b, ['gcc', 'wine']))
first_select_comments = c_api.get_comments(project_name=staging_b)
last_id = sorted(first_select_comments.keys())[-1]
first_select_comment = first_select_comments[last_id]
# Only one comment is added
@@ -46,8 +46,8 @@ class TestSelect(unittest.TestCase):
self.assertTrue('Request#123 for package gcc submitted by [AT]Admin' in first_select_comment['comment'])
# Second select
self.assertEqual(True, SelectCommand(self.api).perform(staging_a, ['puppet']))
second_select_comments = c_api.get_comments(project_name=staging_a)
self.assertEqual(True, SelectCommand(self.api).perform(staging_b, ['puppet']))
second_select_comments = c_api.get_comments(project_name=staging_b)
last_id = sorted(second_select_comments.keys())[-1]
second_select_comment = second_select_comments[last_id]
# The number of comments remains, but they are different