Add a test for accept command when there are multiple SPECs

This commit is contained in:
Alberto Planas 2015-02-26 15:19:29 +01:00
parent fb12a83910
commit 37c7e2a6c6
9 changed files with 68 additions and 4 deletions

View File

@ -57,7 +57,7 @@ def _full_project_name(self, project):
return 'SUSE:%s' % project
# If we can't guess, raise a Warning
warnings.warn('% project not recognized.' % project)
warnings.warn('%s project not recognized.' % project)
return project

View File

@ -51,7 +51,7 @@ DEFAULT = {
'openqa': None,
'lock': None,
'lock-ns': 'OBS',
}
},
}
#

View File

@ -58,6 +58,7 @@ class StagingAPI(object):
self.copenqa = conf.config[project]['openqa']
# If the project support rings, inititialize some variables.
self.ring_packages = {}
if self.crings:
self.rings = (
'{}:0-Bootstrap'.format(self.crings),

View File

@ -0,0 +1,11 @@
<package name="apparmor-doc" project="openSUSE:Factory">
<title>AppArmor userlevel parser utility</title>
<description>
The AppArmor Parser is a userlevel program that is used to load in
program profiles to the AppArmor Security kernel module.
This package is part of a suite of tools that used to be named
SubDomain.
</description>
<devel project="security:apparmor" package="apparmor-doc"/>
</package>

View File

@ -0,0 +1 @@
<entry name="${spec}" md5="84ae6c8586c7e12b44d835af641d6a74" size="27360" mtime="1423765380"/>

View File

@ -0,0 +1,11 @@
<package name="apparmor" project="openSUSE:Factory">
<title>AppArmor userlevel parser utility</title>
<description>
The AppArmor Parser is a userlevel program that is used to load in
program profiles to the AppArmor Security kernel module.
This package is part of a suite of tools that used to be named
SubDomain.
</description>
<devel project="security:apparmor" package="apparmor"/>
</package>

View File

@ -0,0 +1,3 @@
<directory name="apparmor" rev="82" vrev="4" srcmd5="4120eb2ba3d265f7dceb65bbd5923d76">
${entries}
</directory>

View File

@ -0,0 +1,3 @@
<directory name="emacs" rev="113" vrev="4" srcmd5="e894cd3965cf1d930a5c058a82a6040e">
<entry name="emacs.spec" md5="320973b1eb3eaee437e0f882163c2819" size="237405" mtime="1423338472"/>
</directory>

View File

@ -367,10 +367,20 @@ class OBS(object):
'openSUSE:Factory:Staging:J': [],
}
# To track comments created during test execution, even if they have
# been deleted afterward
# To track comments created during test execution, even if
# they have been deleted afterward
self.comment_bodies = []
# Different spec files stored in some openSUSE:Factory
# projects
self.spec_list = {
'openSUSE:Factory/apparmor': [
{
'spec': 'apparmor.spec',
}
],
}
#
# /request/
#
@ -560,6 +570,30 @@ class OBS(object):
return response
@GET(re.compile(r'/source/openSUSE:Factory/apparmor$'))
def source_project_apparmor(self, request, uri, headers):
"""Return apparmor spec list."""
package = re.search(r'/source/([\w:]+/\w+)', uri).group(1)
response = (404, headers, '<result>Not found</result>')
try:
template = string.Template(self._fixture(uri, filename='apparmor.xml'))
entry_template = string.Template(self._fixture(uri, filename='_entry.xml'))
entries = ''.join(entry_template.substitute(entry) for entry in self.spec_list[package])
response = (200, headers, template.substitute({'entries': entries}))
# The next call len() will be 2
if len(self.spec_list[package]) == 1:
self.spec_list[package].append({'spec': 'apparmor-doc.spec'})
except Exception as e:
if DEBUG:
print uri, e
if DEBUG:
print 'SOURCE APPARMOR', uri, response
return response
@GET(re.compile(r'/source/home:Admin/\w+'))
def source_project(self, request, uri, headers):
"""Return information of a source package."""