Rewrite OBS mockup test, fixtures and tests.
This commit is contained in:
@@ -8,11 +8,11 @@ import sys
|
||||
import unittest
|
||||
import httpretty
|
||||
import mock
|
||||
import time
|
||||
|
||||
from string import Template
|
||||
from obs import APIURL
|
||||
from obs import OBS
|
||||
from osc import oscerr
|
||||
from oscs import StagingAPI
|
||||
|
||||
|
||||
PY3 = sys.version_info[0] == 3
|
||||
|
||||
@@ -33,82 +33,68 @@ class TestApiCalls(unittest.TestCase):
|
||||
"""
|
||||
|
||||
self.obs = OBS()
|
||||
self.api = StagingAPI(APIURL)
|
||||
|
||||
@httpretty.activate
|
||||
def test_ring_packages(self):
|
||||
"""
|
||||
Validate the creation of the rings.
|
||||
"""
|
||||
|
||||
# our content in the XML files
|
||||
ring_packages = {
|
||||
'elem-ring-0': 'openSUSE:Factory:Rings:0-Bootstrap',
|
||||
'elem-ring-1': 'openSUSE:Factory:Rings:1-MinimalX',
|
||||
'elem-ring-2': 'openSUSE:Factory:Rings:2-TestDVD',
|
||||
'git': 'openSUSE:Factory:Rings:2-TestDVD',
|
||||
'wine': 'openSUSE:Factory:Rings:1-MinimalX',
|
||||
}
|
||||
self.assertEqual(ring_packages, self.api.ring_packages)
|
||||
|
||||
# Register OBS
|
||||
self.obs.register_obs()
|
||||
self.assertEqual(ring_packages, self.obs.api.ring_packages)
|
||||
|
||||
@httpretty.activate
|
||||
def test_dispatch_open_requests(self):
|
||||
"""
|
||||
Test dispatching and closure of non-ring packages
|
||||
"""
|
||||
|
||||
# Register OBS
|
||||
self.obs.register_obs()
|
||||
|
||||
# Get rid of open requests
|
||||
self.obs.api.dispatch_open_requests()
|
||||
self.api.dispatch_open_requests()
|
||||
# Check that we tried to close it
|
||||
self.assertEqual(httpretty.last_request().method, 'POST')
|
||||
self.assertEqual(httpretty.last_request().querystring[u'cmd'], [u'changereviewstate'])
|
||||
# Try it again
|
||||
self.obs.api.dispatch_open_requests()
|
||||
self.api.dispatch_open_requests()
|
||||
# This time there should be nothing to close
|
||||
self.assertEqual(httpretty.last_request().method, 'GET')
|
||||
|
||||
@httpretty.activate
|
||||
def test_pseudometa_get_prj(self):
|
||||
"""
|
||||
Test getting project metadata from YAML in project description
|
||||
"""
|
||||
|
||||
# Register OBS
|
||||
self.obs.register_obs()
|
||||
|
||||
# Try to get data from project that has no metadata
|
||||
data = self.obs.api.get_prj_pseudometa('openSUSE:Factory:Staging:A')
|
||||
data = self.api.get_prj_pseudometa('openSUSE:Factory:Staging:A')
|
||||
# Should be empty, but contain structure to work with
|
||||
self.assertEqual(data, {'requests': []})
|
||||
# Add some sample data
|
||||
rq = { 'id': '123', 'package': 'test-package' }
|
||||
rq = {'id': '123', 'package': 'test-package'}
|
||||
data['requests'].append(rq)
|
||||
# Save them and read them back
|
||||
self.obs.api.set_prj_pseudometa('openSUSE:Factory:Staging:A',data)
|
||||
test_data = self.obs.api.get_prj_pseudometa('openSUSE:Factory:Staging:A')
|
||||
self.api.set_prj_pseudometa('openSUSE:Factory:Staging:A', data)
|
||||
test_data = self.api.get_prj_pseudometa('openSUSE:Factory:Staging:A')
|
||||
# Verify that we got back the same data
|
||||
self.assertEqual(data,test_data)
|
||||
self.assertEqual(data, test_data)
|
||||
|
||||
@httpretty.activate
|
||||
def test_list_projects(self):
|
||||
"""
|
||||
List projects and their content
|
||||
"""
|
||||
|
||||
self.obs.register_obs()
|
||||
|
||||
# Prepare expected results
|
||||
data = []
|
||||
for prj in self.obs.st_project_data:
|
||||
for prj in self.obs.staging_project:
|
||||
data.append('openSUSE:Factory:Staging:' + prj)
|
||||
|
||||
# Compare the results
|
||||
self.assertEqual(data, self.obs.api.get_staging_projects())
|
||||
self.assertEqual(data, self.api.get_staging_projects())
|
||||
|
||||
@httpretty.activate
|
||||
def test_open_requests(self):
|
||||
"""
|
||||
Test searching for open requests
|
||||
@@ -116,140 +102,138 @@ class TestApiCalls(unittest.TestCase):
|
||||
|
||||
requests = []
|
||||
|
||||
self.obs.register_obs()
|
||||
|
||||
# get the open requests
|
||||
requests = self.obs.api.get_open_requests()
|
||||
requests = self.api.get_open_requests()
|
||||
|
||||
# Compare the results, we only care now that we got 1 of them not the content
|
||||
self.assertEqual(1, len(requests))
|
||||
|
||||
@httpretty.activate
|
||||
def test_get_package_information(self):
|
||||
"""
|
||||
Test if we get proper project, name and revision from the staging informations
|
||||
"""
|
||||
|
||||
package_info = {'project': 'home:Admin',
|
||||
'rev': '7b98ac01b8071d63a402fa99dc79331c',
|
||||
'srcmd5': '7b98ac01b8071d63a402fa99dc79331c',
|
||||
'package': 'wine'}
|
||||
|
||||
self.obs.register_obs()
|
||||
package_info = {
|
||||
'project': 'home:Admin',
|
||||
'rev': '7b98ac01b8071d63a402fa99dc79331c',
|
||||
'srcmd5': '7b98ac01b8071d63a402fa99dc79331c',
|
||||
'package': 'wine'
|
||||
}
|
||||
|
||||
# Compare the results, we only care now that we got 2 of them not the content
|
||||
self.assertEqual(package_info,
|
||||
self.obs.api.get_package_information('openSUSE:Factory:Staging:B', 'wine'))
|
||||
self.assertEqual(
|
||||
package_info,
|
||||
self.api.get_package_information('openSUSE:Factory:Staging:B', 'wine'))
|
||||
|
||||
@httpretty.activate
|
||||
def test_request_id_package_mapping(self):
|
||||
"""
|
||||
Test whether we can get correct id for sr in staging project
|
||||
"""
|
||||
|
||||
self.obs.register_obs()
|
||||
|
||||
prj = 'openSUSE:Factory:Staging:B'
|
||||
# Get rq
|
||||
num = self.obs.api.get_request_id_for_package(prj, 'wine')
|
||||
self.assertEqual(333,num)
|
||||
num = self.api.get_request_id_for_package(prj, 'wine')
|
||||
self.assertEqual(333, num)
|
||||
# Get package name
|
||||
self.assertEqual('wine',self.obs.api.get_package_for_request_id(prj, num))
|
||||
self.assertEqual('wine', self.api.get_package_for_request_id(prj, num))
|
||||
|
||||
@httpretty.activate
|
||||
def test_check_one_request(self):
|
||||
self.obs.register_obs()
|
||||
|
||||
prj = 'openSUSE:Factory:Staging:B'
|
||||
pkg = 'wine'
|
||||
|
||||
full_name = prj + '/' + pkg
|
||||
|
||||
# Verify package is there
|
||||
self.assertEqual(self.obs.links_data.has_key(prj + '/' + pkg),True)
|
||||
self.assertTrue(full_name in self.obs.links)
|
||||
# Get rq number
|
||||
num = self.obs.api.get_request_id_for_package(prj, pkg)
|
||||
num = self.api.get_request_id_for_package(prj, pkg)
|
||||
# Check the results
|
||||
self.assertEqual(self.obs.api.check_one_request(num,prj), None)
|
||||
self.assertEqual(self.api.check_one_request(num, prj), None)
|
||||
# Pretend to be reviewed by other project
|
||||
self.assertEqual(self.obs.api.check_one_request(num,'xyz'),
|
||||
self.assertEqual(self.api.check_one_request(num, 'xyz'),
|
||||
'wine: missing reviews: openSUSE:Factory:Staging:B')
|
||||
|
||||
@httpretty.activate
|
||||
def test_check_project_status(self):
|
||||
self.obs.register_obs()
|
||||
|
||||
# Check the results
|
||||
with mock.patch('oscs.StagingAPI.find_openqa_state', return_value="Nothing"):
|
||||
broken_results = ['At least following repositories is still building:',
|
||||
' building/x86_64: building',
|
||||
'Following packages are broken:',
|
||||
' wine (failed/x86_64): failed',
|
||||
' wine (broken/x86_64): broken',
|
||||
'Nothing']
|
||||
self.assertEqual(self.obs.api.check_project_status('openSUSE:Factory:Staging:B'), broken_results)
|
||||
self.assertEqual(self.obs.api.check_project_status('openSUSE:Factory:Staging:A'), False)
|
||||
with mock.patch('oscs.StagingAPI.find_openqa_state', return_value='Nothing'):
|
||||
broken_results = ['At least following repositories is still building:',
|
||||
' building/x86_64: building',
|
||||
'Following packages are broken:',
|
||||
' wine (failed/x86_64): failed',
|
||||
' wine (broken/x86_64): broken',
|
||||
'Nothing']
|
||||
self.assertEqual(self.api.check_project_status('openSUSE:Factory:Staging:B'), broken_results)
|
||||
self.assertEqual(self.api.check_project_status('openSUSE:Factory:Staging:A'), False)
|
||||
|
||||
@httpretty.activate
|
||||
def test_rm_from_prj(self):
|
||||
self.obs.register_obs()
|
||||
|
||||
prj = 'openSUSE:Factory:Staging:B'
|
||||
pkg = 'wine'
|
||||
|
||||
full_name = prj + '/' + pkg
|
||||
|
||||
# Verify package is there
|
||||
self.assertEqual(self.obs.links_data.has_key(prj + '/' + pkg),True)
|
||||
self.assertTrue(full_name in self.obs.links)
|
||||
|
||||
# Get rq number
|
||||
num = self.obs.api.get_request_id_for_package(prj, pkg)
|
||||
# Delete the package
|
||||
self.obs.api.rm_from_prj(prj, package='wine');
|
||||
# Verify package is not there
|
||||
self.assertEqual(self.obs.links_data.has_key(prj + '/' + pkg),False)
|
||||
# RQ is gone
|
||||
self.assertEqual(None, self.obs.api.get_request_id_for_package(prj, pkg))
|
||||
self.assertEqual(None, self.obs.api.get_package_for_request_id(prj, num))
|
||||
# Verify that review is closed
|
||||
self.assertEqual('accepted', self.obs.requests_data[str(num)]['review'])
|
||||
self.assertEqual('new', self.obs.requests_data[str(num)]['request'])
|
||||
num = self.api.get_request_id_for_package(prj, pkg)
|
||||
|
||||
# Delete the package
|
||||
self.api.rm_from_prj(prj, package='wine')
|
||||
|
||||
# Verify package is not there
|
||||
self.assertTrue(full_name not in self.obs.links)
|
||||
|
||||
# RQ is gone
|
||||
self.assertEqual(None, self.api.get_request_id_for_package(prj, pkg))
|
||||
self.assertEqual(None, self.api.get_package_for_request_id(prj, num))
|
||||
|
||||
# Verify that review is closed
|
||||
self.assertEqual('accepted', self.obs.requests[str(num)]['review'])
|
||||
self.assertEqual('new', self.obs.requests[str(num)]['request'])
|
||||
|
||||
def test_rm_from_prj_2(self):
|
||||
# Try the same with request number
|
||||
self.obs.reset_config()
|
||||
prj = 'openSUSE:Factory:Staging:B'
|
||||
pkg = 'wine'
|
||||
|
||||
full_name = prj + '/' + pkg
|
||||
|
||||
# Get rq number
|
||||
num = self.api.get_request_id_for_package(prj, pkg)
|
||||
|
||||
# Delete the package
|
||||
self.obs.api.rm_from_prj(prj, request_id=num);
|
||||
self.api.rm_from_prj(prj, request_id=num)
|
||||
|
||||
# Verify package is not there
|
||||
self.assertEqual(self.obs.links_data.has_key(prj + '/' + pkg),False)
|
||||
self.assertTrue(full_name not in self.obs.links)
|
||||
|
||||
# RQ is gone
|
||||
self.assertEqual(None, self.obs.api.get_request_id_for_package(prj, pkg))
|
||||
self.assertEqual(None, self.obs.api.get_package_for_request_id(prj, num))
|
||||
self.assertEqual(None, self.api.get_request_id_for_package(prj, pkg))
|
||||
self.assertEqual(None, self.api.get_package_for_request_id(prj, num))
|
||||
|
||||
# Verify that review is closed
|
||||
self.assertEqual('accepted', self.obs.requests_data[str(num)]['review'])
|
||||
self.assertEqual('new', self.obs.requests_data[str(num)]['request'])
|
||||
self.assertEqual('accepted', self.obs.requests[str(num)]['review'])
|
||||
self.assertEqual('new', self.obs.requests[str(num)]['request'])
|
||||
|
||||
@httpretty.activate
|
||||
def test_add_sr(self):
|
||||
self.obs.register_obs()
|
||||
|
||||
prj = 'openSUSE:Factory:Staging:A'
|
||||
rq = '123'
|
||||
pkg = self.obs.requests_data[rq]['package']
|
||||
|
||||
# Running it twice shouldn't change anything
|
||||
for i in [1,2]:
|
||||
for i in range(2):
|
||||
# Add rq to the project
|
||||
self.obs.api.rq_to_prj(rq, prj);
|
||||
self.api.rq_to_prj(rq, prj)
|
||||
# Verify that review is there
|
||||
self.assertEqual('new', self.obs.requests_data[str(rq)]['review'])
|
||||
self.assertEqual('review', self.obs.requests_data[str(rq)]['request'])
|
||||
self.assertEqual(self.obs.api.get_prj_pseudometa('openSUSE:Factory:Staging:A'),
|
||||
self.assertEqual('new', self.obs.requests[rq]['review'])
|
||||
self.assertEqual('review', self.obs.requests[rq]['request'])
|
||||
self.assertEqual(self.api.get_prj_pseudometa('openSUSE:Factory:Staging:A'),
|
||||
{'requests': [{'id': 123, 'package': 'gcc'}]})
|
||||
|
||||
@httpretty.activate
|
||||
def test_generate_build_status_details(self):
|
||||
"""
|
||||
Check whether generate_build_status_details works
|
||||
"""
|
||||
"""Check whether generate_build_status_details works."""
|
||||
|
||||
self.obs.register_obs()
|
||||
details_green = self.obs.api.gather_build_status('green')
|
||||
details_red = self.obs.api.gather_build_status('red')
|
||||
details_green = self.api.gather_build_status('green')
|
||||
details_red = self.api.gather_build_status('red')
|
||||
red = ['red', [{'path': 'standard/x86_64', 'state': 'building'}],
|
||||
[{'path': 'standard/i586', 'state': 'broken', 'pkg': 'glibc'},
|
||||
{'path': 'standard/i586', 'state': 'failed', 'pkg': 'openSUSE-images'}]]
|
||||
@@ -257,134 +241,95 @@ class TestApiCalls(unittest.TestCase):
|
||||
' standard/x86_64: building',
|
||||
'Following packages are broken:',
|
||||
' glibc (standard/i586): broken',
|
||||
' openSUSE-images (standard/i586): failed'
|
||||
]
|
||||
' openSUSE-images (standard/i586): failed']
|
||||
|
||||
self.assertEqual(details_red, red)
|
||||
self.assertEqual(self.obs.api.generate_build_status_details(details_red), red_result)
|
||||
self.assertEqual(self.obs.api.generate_build_status_details(details_red,True), red_result)
|
||||
self.assertEqual(self.api.generate_build_status_details(details_red), red_result)
|
||||
self.assertEqual(self.api.generate_build_status_details(details_red, True), red_result)
|
||||
self.assertEqual(details_green, None)
|
||||
self.assertEqual(self.obs.api.generate_build_status_details(details_green), [])
|
||||
self.assertEqual(self.api.generate_build_status_details(details_green), [])
|
||||
|
||||
@httpretty.activate
|
||||
def test_create_package_container(self):
|
||||
"""
|
||||
Test if the uploaded _meta is correct
|
||||
"""
|
||||
"""Test if the uploaded _meta is correct."""
|
||||
|
||||
self.obs.register_obs()
|
||||
|
||||
self.obs.api.create_package_container('openSUSE:Factory:Staging:B', 'wine')
|
||||
self.api.create_package_container('openSUSE:Factory:Staging:B', 'wine')
|
||||
self.assertEqual(httpretty.last_request().method, 'PUT')
|
||||
self.assertEqual(httpretty.last_request().body, '<package name="wine"><title/><description/></package>')
|
||||
self.assertEqual(httpretty.last_request().path, '/source/openSUSE:Factory:Staging:B/wine/_meta')
|
||||
|
||||
self.obs.api.create_package_container('openSUSE:Factory:Staging:B', 'wine', disable_build=True)
|
||||
self.api.create_package_container('openSUSE:Factory:Staging:B', 'wine', disable_build=True)
|
||||
self.assertEqual(httpretty.last_request().method, 'PUT')
|
||||
self.assertEqual(httpretty.last_request().body, '<package name="wine"><title /><description /><build><disable /></build></package>')
|
||||
self.assertEqual(httpretty.last_request().path, '/source/openSUSE:Factory:Staging:B/wine/_meta')
|
||||
|
||||
@httpretty.activate
|
||||
def test_review_handling(self):
|
||||
"""
|
||||
Test whether accepting/creating reviews behaves correctly
|
||||
"""
|
||||
|
||||
# Register OBS
|
||||
self.obs.register_obs()
|
||||
"""Test whether accepting/creating reviews behaves correctly."""
|
||||
|
||||
# Add review
|
||||
self.obs.api.add_review('123', by_project='openSUSE:Factory:Staging:A')
|
||||
self.api.add_review('123', by_project='openSUSE:Factory:Staging:A')
|
||||
self.assertEqual(httpretty.last_request().method, 'POST')
|
||||
self.assertEqual(httpretty.last_request().querystring[u'cmd'], [u'addreview'])
|
||||
# Try to readd, should do anything
|
||||
self.obs.api.add_review('123', by_project='openSUSE:Factory:Staging:A')
|
||||
self.api.add_review('123', by_project='openSUSE:Factory:Staging:A')
|
||||
self.assertEqual(httpretty.last_request().method, 'GET')
|
||||
# Accept review
|
||||
self.obs.api.set_review('123', 'openSUSE:Factory:Staging:A')
|
||||
self.api.set_review('123', 'openSUSE:Factory:Staging:A')
|
||||
self.assertEqual(httpretty.last_request().method, 'POST')
|
||||
self.assertEqual(httpretty.last_request().querystring[u'cmd'], [u'changereviewstate'])
|
||||
# Try to accept it again should do anything
|
||||
self.obs.api.set_review('123', 'openSUSE:Factory:Staging:A')
|
||||
self.api.set_review('123', 'openSUSE:Factory:Staging:A')
|
||||
self.assertEqual(httpretty.last_request().method, 'GET')
|
||||
# But we should be able to reopen it
|
||||
self.obs.api.add_review('123', by_project='openSUSE:Factory:Staging:A')
|
||||
self.api.add_review('123', by_project='openSUSE:Factory:Staging:A')
|
||||
self.assertEqual(httpretty.last_request().method, 'POST')
|
||||
self.assertEqual(httpretty.last_request().querystring[u'cmd'], [u'addreview'])
|
||||
|
||||
@httpretty.activate
|
||||
def test_prj_from_letter(self):
|
||||
# Register OBS
|
||||
self.obs.register_obs()
|
||||
|
||||
# Verify it works
|
||||
self.assertEqual(self.obs.api.prj_from_letter('openSUSE:Factory'), 'openSUSE:Factory')
|
||||
self.assertEqual(self.obs.api.prj_from_letter('A'), 'openSUSE:Factory:Staging:A')
|
||||
self.assertEqual(self.api.prj_from_letter('openSUSE:Factory'), 'openSUSE:Factory')
|
||||
self.assertEqual(self.api.prj_from_letter('A'), 'openSUSE:Factory:Staging:A')
|
||||
|
||||
@httpretty.activate
|
||||
def test_check_project_status_green(self):
|
||||
"""
|
||||
Test checking project status
|
||||
"""
|
||||
# Register OBS
|
||||
self.obs.register_obs()
|
||||
"""Test checking project status."""
|
||||
|
||||
# Check print output
|
||||
self.assertEqual(self.obs.api.gather_build_status("green"), None)
|
||||
self.assertEqual(self.api.gather_build_status('green'), None)
|
||||
|
||||
@httpretty.activate
|
||||
def test_check_project_status_red(self):
|
||||
"""
|
||||
Test checking project status
|
||||
"""
|
||||
|
||||
# Register OBS
|
||||
self.obs.register_obs()
|
||||
"""Test checking project status."""
|
||||
|
||||
# Check print output
|
||||
self.assertEqual(self.obs.api.gather_build_status('red'),
|
||||
['red', [{'path': 'standard/x86_64', 'state': 'building'}],
|
||||
[{'path': 'standard/i586', 'pkg': 'glibc', 'state': 'broken'},
|
||||
{'path': 'standard/i586', 'pkg': 'openSUSE-images', 'state': 'failed'}]])
|
||||
self.assertEqual(
|
||||
self.api.gather_build_status('red'),
|
||||
['red', [{'path': 'standard/x86_64', 'state': 'building'}],
|
||||
[{'path': 'standard/i586', 'pkg': 'glibc', 'state': 'broken'},
|
||||
{'path': 'standard/i586', 'pkg': 'openSUSE-images', 'state': 'failed'}]])
|
||||
|
||||
@httpretty.activate
|
||||
def test_frozen_mtime(self):
|
||||
"""
|
||||
Test frozen mtime
|
||||
"""
|
||||
|
||||
# Register OBS
|
||||
self.obs.register_obs()
|
||||
"""Test frozen mtime."""
|
||||
|
||||
# Testing frozen mtime
|
||||
self.assertTrue(self.obs.api.days_since_last_freeze('openSUSE:Factory:Staging:A') > 8)
|
||||
self.assertTrue(self.obs.api.days_since_last_freeze('openSUSE:Factory:Staging:B') < 1)
|
||||
self.assertTrue(self.api.days_since_last_freeze('openSUSE:Factory:Staging:A') > 8)
|
||||
self.assertTrue(self.api.days_since_last_freeze('openSUSE:Factory:Staging:B') < 1)
|
||||
|
||||
# U == unfrozen
|
||||
self.assertTrue(self.obs.api.days_since_last_freeze('openSUSE:Factory:Staging:U') > 1000)
|
||||
self.assertTrue(self.api.days_since_last_freeze('openSUSE:Factory:Staging:U') > 1000)
|
||||
|
||||
@httpretty.activate
|
||||
def test_frozen_enough(self):
|
||||
"""
|
||||
Test frozen enough
|
||||
"""
|
||||
|
||||
# Register OBS
|
||||
self.obs.register_obs()
|
||||
"""Test frozen enough."""
|
||||
|
||||
# Testing frozen mtime
|
||||
self.assertEqual(self.obs.api.prj_frozen_enough('openSUSE:Factory:Staging:B'), True)
|
||||
self.assertEqual(self.obs.api.prj_frozen_enough('openSUSE:Factory:Staging:A'), False)
|
||||
self.assertEqual(self.api.prj_frozen_enough('openSUSE:Factory:Staging:B'), True)
|
||||
self.assertEqual(self.api.prj_frozen_enough('openSUSE:Factory:Staging:A'), False)
|
||||
|
||||
# U == unfrozen
|
||||
self.assertEqual(self.obs.api.prj_frozen_enough('openSUSE:Factory:Staging:U'), False)
|
||||
self.assertEqual(self.api.prj_frozen_enough('openSUSE:Factory:Staging:U'), False)
|
||||
|
||||
@httpretty.activate
|
||||
def test_move(self):
|
||||
"""Test package movement."""
|
||||
|
||||
# Register OBS
|
||||
self.obs.register_obs()
|
||||
|
||||
init_data = self.obs.api.get_package_information('openSUSE:Factory:Staging:B', 'wine')
|
||||
self.obs.api.move_between_project('openSUSE:Factory:Staging:B', 333, 'openSUSE:Factory:Staging:A')
|
||||
test_data = self.obs.api.get_package_information('openSUSE:Factory:Staging:A', 'wine')
|
||||
init_data = self.api.get_package_information('openSUSE:Factory:Staging:B', 'wine')
|
||||
self.api.move_between_project('openSUSE:Factory:Staging:B', 333, 'openSUSE:Factory:Staging:A')
|
||||
test_data = self.api.get_package_information('openSUSE:Factory:Staging:A', 'wine')
|
||||
self.assertEqual(init_data, test_data)
|
||||
|
171
tests/fixtures/220956-open.xml
vendored
171
tests/fixtures/220956-open.xml
vendored
@@ -1,171 +0,0 @@
|
||||
<request id="220956">
|
||||
<action type="submit">
|
||||
<source project="devel:languages:python:Factory" package="python3" rev="125"/>
|
||||
<target project="openSUSE:Factory" package="python3"/>
|
||||
</action>
|
||||
<state name="review" who="factory-auto" when="2014-02-05T10:13:08">
|
||||
<comment>Check Staging Project</comment>
|
||||
</state>
|
||||
<review state="accepted" when="2014-02-05T10:09:55" who="licensedigger" by_group="legal-auto">
|
||||
<comment>{"approve": "preliminary, version number changed"} <!-- {
|
||||
"dest": {
|
||||
"ldb": {
|
||||
"prodonly": "",
|
||||
"review": "done",
|
||||
"rpm_license": "{\"python3.spec\":{\"curses\":[\"Python-2.0\"],\"python3\":[\"Python-2.0\"],\"dbm\":[\"Python-2.0\"],\"tk\":[\"Python-2.0\"]},\"python3-base.spec\":{\"-n python3-tools\":[\"Python-2.0\"],\"-n python3-idle\":[\"Python-2.0\"],\"python3-base\":[\"Python-2.0\"],\"-n python3-testsuite\":[\"Python-2.0\"],\"-n libpython%{so_version}\":[\"Python-2.0\"],\"-n python3-devel\":[\"Python-2.0\"]},\"python3-doc.spec\":{\"python3-doc\":[\"Python-2.0\"],\"pdf\":[\"Python-2.0\"]}}",
|
||||
"status": "production",
|
||||
"version": "3.3.3"
|
||||
},
|
||||
"license": {
|
||||
"python3-base.spec": {
|
||||
"-n libpython%{so_version}": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"-n python3-devel": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"-n python3-idle": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"-n python3-testsuite": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"-n python3-tools": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"python3-base": [
|
||||
"Python-2.0"
|
||||
]
|
||||
},
|
||||
"python3-doc.spec": {
|
||||
"pdf": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"python3-doc": [
|
||||
"Python-2.0"
|
||||
]
|
||||
},
|
||||
"python3.spec": {
|
||||
"curses": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"dbm": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"python3": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"tk": [
|
||||
"Python-2.0"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": "3.3.3"
|
||||
},
|
||||
"hint": [
|
||||
"version changed: src('3.3.3') differs from dest('3.4.0~b3')"
|
||||
],
|
||||
"plugin": "0.60",
|
||||
"src": {
|
||||
"auto-co": "/api.opensuse.org/devel:languages:python:Factory/python3%3.4.0~b3%r125",
|
||||
"kiwi_only": false,
|
||||
"license": {
|
||||
"python3-base.spec": {
|
||||
"-n libpython%{so_version}": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"-n python3-devel": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"-n python3-idle": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"-n python3-testsuite": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"-n python3-tools": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"python3-base": [
|
||||
"Python-2.0"
|
||||
]
|
||||
},
|
||||
"python3-doc.spec": {
|
||||
"pdf": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"python3-doc": [
|
||||
"Python-2.0"
|
||||
]
|
||||
},
|
||||
"python3.spec": {
|
||||
"curses": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"dbm": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"python3": [
|
||||
"Python-2.0"
|
||||
],
|
||||
"tk": [
|
||||
"Python-2.0"
|
||||
]
|
||||
}
|
||||
},
|
||||
"rev": "125",
|
||||
"version": "3.4.0~b3",
|
||||
"version_diff": "src('3.3.3') differs from dest('3.4.0~b3')"
|
||||
}
|
||||
} --></comment>
|
||||
</review>
|
||||
<review state="accepted" when="2014-02-05T10:09:55" who="factory-auto" by_group="factory-auto">
|
||||
<comment>Check script succeeded</comment>
|
||||
</review>
|
||||
<review state="accepted" when="2014-02-05T10:13:07" who="a_jaeger" by_group="opensuse-review-team">
|
||||
<comment>ok</comment>
|
||||
</review>
|
||||
<review state="accepted" when="2014-02-05T10:13:08" who="factory-repo-checker" by_user="factory-repo-checker">
|
||||
<comment>Builds for repo openSUSE_Factory</comment>
|
||||
</review>
|
||||
<review state="new" by_group="factory-staging">
|
||||
<comment>Check Staging Project</comment>
|
||||
</review>
|
||||
<history name="review" who="saschpe" when="2014-02-05T10:09:55"/>
|
||||
<history name="review" who="factory-auto" when="2014-02-05T10:13:07">
|
||||
<comment>Please review sources</comment>
|
||||
</history>
|
||||
<history name="review" who="factory-auto" when="2014-02-05T10:13:08">
|
||||
<comment>Please review build success</comment>
|
||||
</history>
|
||||
<description>- initial commit of 3.4.0 beta 3
|
||||
* new stdlib modules: pathlib, enum, statistics, tracemalloc
|
||||
* asynchronous IO with new asyncio module
|
||||
* introspection data for builtins
|
||||
* subprocesses no longer inherit open file descriptors
|
||||
* standardized metadata for packages
|
||||
* internal hashing changed to SipHash
|
||||
* new pickle protocol
|
||||
* improved handling of codecs
|
||||
* TLS 1.2 support
|
||||
* major speed improvements for internal unicode handling
|
||||
* many bugfixes and optimizations
|
||||
- see porting guide at:
|
||||
http://docs.python.org/3.4/whatsnew/3.4.html#porting-to-python-3-4
|
||||
- moved several modules to -testsuite subpackage
|
||||
- updated list of binary extensions, refreshed patches
|
||||
- tracemalloc_gcov.patch fixes profile-based optimization build
|
||||
- updated packages and pre_checkin.sh to use ~-version notation
|
||||
for prereleases
|
||||
- fix-shebangs part of build process moved to common %prep
|
||||
- drop python-3.3.2-no-REUSEPORT.patch (upstreamed)
|
||||
- update baselibs for new soname
|
||||
- TODOs:
|
||||
* require python-pip, make ensurepip work with zypper
|
||||
|
||||
- initial commit of 3.4.0 beta2
|
||||
* for full changelog, see python3-base
|
||||
|
||||
- initial commit of 3.4.0 beta 3
|
||||
* for full changelog, see python3-base</description>
|
||||
</request>
|
3
tests/fixtures/build-project.xml
vendored
3
tests/fixtures/build-project.xml
vendored
@@ -1,3 +0,0 @@
|
||||
<directory count='1'>
|
||||
<entry name="zlib"/>
|
||||
</directory>
|
11
tests/fixtures/build/openSUSE:Factory:Staging:B/_result
vendored
Normal file
11
tests/fixtures/build/openSUSE:Factory:Staging:B/_result
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<resultlist state="c7856c90c70c53fae88aacec964b80c0">
|
||||
<result project="openSUSE:Factory:Staging:B" repository="failed" arch="x86_64" code="published" state="published">
|
||||
<status package="wine" code="failed" />
|
||||
</result>
|
||||
<result project="openSUSE:Factory:Staging:B" repository="broken" arch="x86_64" code="published" state="published">
|
||||
<status package="wine" code="broken" />
|
||||
</result>
|
||||
<result project="openSUSE:Factory:Staging:B" repository="building" arch="x86_64" code="building" state="building">
|
||||
<status package="wine" code="building" />
|
||||
</result>
|
||||
</resultlist>
|
8
tests/fixtures/check_project_status_red.txt
vendored
8
tests/fixtures/check_project_status_red.txt
vendored
@@ -1,8 +0,0 @@
|
||||
Following repositories are still building:
|
||||
standard/x86_64: building
|
||||
|
||||
Following packages are broken:
|
||||
glibc (standard/i586): broken
|
||||
openSUSE-images (standard/i586): failed
|
||||
|
||||
Found errors in staging project red!
|
3
tests/fixtures/core-project.xml
vendored
3
tests/fixtures/core-project.xml
vendored
@@ -1,3 +0,0 @@
|
||||
<directory count='1'>
|
||||
<entry name="DirectFB"/>
|
||||
</directory>
|
3
tests/fixtures/dvd-project.xml
vendored
3
tests/fixtures/dvd-project.xml
vendored
@@ -1,3 +0,0 @@
|
||||
<directory count='1'>
|
||||
<entry name="Botan"/>
|
||||
</directory>
|
3
tests/fixtures/maindesktops-project.xml
vendored
3
tests/fixtures/maindesktops-project.xml
vendored
@@ -1,3 +0,0 @@
|
||||
<directory count='1'>
|
||||
<entry name="AGGR-antlr"/>
|
||||
</directory>
|
1
tests/fixtures/request/123
vendored
Symbolic link
1
tests/fixtures/request/123
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
template_request.xml
|
1
tests/fixtures/request/321
vendored
Symbolic link
1
tests/fixtures/request/321
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
template_request.xml
|
1
tests/fixtures/request/333
vendored
Symbolic link
1
tests/fixtures/request/333
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
template_request.xml
|
1
tests/fixtures/request/result.xml
vendored
Symbolic link
1
tests/fixtures/request/result.xml
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../search/request/result.xml
|
3
tests/fixtures/search/project/id/result.xml
vendored
Normal file
3
tests/fixtures/search/project/id/result.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<collection matches="${nprojects}">
|
||||
${projects}
|
||||
</collection>
|
1
tests/fixtures/search/request/id/result.xml
vendored
Symbolic link
1
tests/fixtures/search/request/id/result.xml
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../result.xml
|
3
tests/fixtures/search/request/result.xml
vendored
Normal file
3
tests/fixtures/search/request/result.xml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<collection matches="${nrequests}">
|
||||
${requests}
|
||||
</collection>
|
1
tests/fixtures/source/home:Admin/wine
vendored
Normal file
1
tests/fixtures/source/home:Admin/wine
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<directory name="${name}" rev="${rev}" vrev="${vrev}" srcmd5="${srcmd5}"/>
|
4
tests/fixtures/source/openSUSE:Factory:Rings:2-TestDVD
vendored
Normal file
4
tests/fixtures/source/openSUSE:Factory:Rings:2-TestDVD
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<directory count='1'>
|
||||
<entry name="elem-ring-2"/>
|
||||
<entry name="git"/>
|
||||
</directory>
|
1
tests/fixtures/source/openSUSE:Factory:Staging:A/wine
vendored
Symbolic link
1
tests/fixtures/source/openSUSE:Factory:Staging:A/wine
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../linksource.xml
|
1
tests/fixtures/source/openSUSE:Factory:Staging:B/_meta
vendored
Symbolic link
1
tests/fixtures/source/openSUSE:Factory:Staging:B/_meta
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../openSUSE:Factory:Staging:A/_meta
|
1
tests/fixtures/source/openSUSE:Factory:Staging:B/_project
vendored
Symbolic link
1
tests/fixtures/source/openSUSE:Factory:Staging:B/_project
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../openSUSE:Factory:Staging:A/_project
|
1
tests/fixtures/source/openSUSE:Factory:Staging:B/wine
vendored
Symbolic link
1
tests/fixtures/source/openSUSE:Factory:Staging:B/wine
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../linksource.xml
|
1
tests/fixtures/source/openSUSE:Factory:Staging:U/_meta
vendored
Symbolic link
1
tests/fixtures/source/openSUSE:Factory:Staging:U/_meta
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../openSUSE:Factory:Staging:A/_meta
|
72
tests/fixtures/systemd-search-results.xml
vendored
72
tests/fixtures/systemd-search-results.xml
vendored
@@ -1,72 +0,0 @@
|
||||
<collection matches="1">
|
||||
<request id="123">
|
||||
<action type="submit">
|
||||
<source project="Base:System" package="systemd" rev="536"/>
|
||||
<target project="openSUSE:Factory" package="systemd"/>
|
||||
</action>
|
||||
<state name="review" who="coolo" when="2014-03-05T15:37:34">
|
||||
<comment>Being evaluated by staging project "openSUSE:Factory:Staging:D"</comment>
|
||||
</state>
|
||||
<review state="accepted" when="2014-03-04T10:58:36" who="factory-auto" by_group="factory-auto">
|
||||
<comment>Check script succeeded</comment>
|
||||
</review>
|
||||
<review state="accepted" when="2014-03-04T11:03:42" who="dimstar" by_group="opensuse-review-team">
|
||||
<comment>ok</comment>
|
||||
</review>
|
||||
<review state="accepted" when="2014-03-04T11:03:43" who="factory-repo-checker" by_user="factory-repo-checker">
|
||||
<comment>Builds for repo openSUSE_Factory</comment>
|
||||
</review>
|
||||
<review state="accepted" when="2014-03-04T11:03:43" who="scarabeus_iv" by_group="factory-staging">
|
||||
<comment/>
|
||||
</review>
|
||||
<review state="accepted" when="2014-03-04T11:27:50" who="coolo" by_project="openSUSE:Factory:Staging:B">
|
||||
<comment/>
|
||||
</review>
|
||||
<review state="new" by_project="openSUSE:Factory:Staging:D">
|
||||
<comment>Being evaluated by staging project "openSUSE:Factory:Staging:D"</comment>
|
||||
</review>
|
||||
<history name="review" who="WernerFink" when="2014-03-04T10:58:36"/>
|
||||
<history name="review" who="factory-auto" when="2014-03-04T11:03:42">
|
||||
<comment>Please review sources</comment>
|
||||
</history>
|
||||
<history name="review" who="factory-auto" when="2014-03-04T11:03:43">
|
||||
<comment>Please review build success</comment>
|
||||
</history>
|
||||
<history name="review" who="factory-auto" when="2014-03-04T11:03:43">
|
||||
<comment>Pick Staging Project</comment>
|
||||
</history>
|
||||
<history name="review" who="scarabeus_iv" when="2014-03-04T11:27:50">
|
||||
<comment>Being evaluated by staging project "openSUSE:Factory:Staging:B"</comment>
|
||||
</history>
|
||||
<description>- Make patch 1006-udev-always-rename-network.patch work again
|
||||
and add it again.
|
||||
|
||||
- address missing owner functionality in systemd-tmpfiles (fate#314974)
|
||||
1022-systemd-tmpfiles-ownerkeep.patch
|
||||
|
||||
- Generate the bash completion files on the fly for th ecase of
|
||||
not having the package bash-completion around
|
||||
|
||||
- Update to Release v210
|
||||
+ systemd will now relabel /dev after loading the SMACK policy
|
||||
according to SMACK rules.
|
||||
+ A new unit file option AppArmoreProfile= has been added to
|
||||
set the AppArmor profile for the processes of a unit.
|
||||
+ A new condition check ConditionArchitecture= has been added
|
||||
to conditionalize units based on the system architecture, as
|
||||
reported by uname()'s "machine" field.
|
||||
+ systemd-networkd now supports matching on the system
|
||||
virtualization, architecture, kernel command line, host name
|
||||
and machine ID.
|
||||
+ logind is now a lot more aggressive when suspending the
|
||||
machine due to a closed laptop lid.
|
||||
+ logind will now watch SW_DOCK switches and inhibit reaction
|
||||
to the lid switch if it is pressed.
|
||||
+ nspawn will now make use of the devices cgroup controller by
|
||||
default, and only permit creation of and access to the usual
|
||||
API device nodes like /dev/null or /dev/random, as well as
|
||||
access to (but not creation of) the pty devices.
|
||||
+ systemd will now understand the usual M, K, G, T suffixes
|
||||
according to SI conventions (i.e. to the base 1000) when</description>
|
||||
</request>
|
||||
</collection>
|
@@ -12,6 +12,7 @@ import tempfile
|
||||
|
||||
from osclib.freeze_command import FreezeCommand
|
||||
|
||||
|
||||
class TestFreeze(unittest.TestCase):
|
||||
def _get_fixture_path(self, filename):
|
||||
"""
|
||||
|
1035
tests/obs.py
1035
tests/obs.py
File diff suppressed because it is too large
Load Diff
@@ -9,9 +9,12 @@ import unittest
|
||||
import httpretty
|
||||
import time
|
||||
|
||||
from obs import APIURL
|
||||
from obs import OBS
|
||||
from osc import oscerr
|
||||
from osclib.select_command import SelectCommand
|
||||
from oscs import StagingAPI
|
||||
|
||||
|
||||
class TestSelect(unittest.TestCase):
|
||||
|
||||
@@ -19,31 +22,22 @@ class TestSelect(unittest.TestCase):
|
||||
"""
|
||||
Initialize the configuration
|
||||
"""
|
||||
|
||||
self.obs = OBS()
|
||||
self.api = StagingAPI(APIURL)
|
||||
|
||||
@httpretty.activate
|
||||
def test_old_frozen(self):
|
||||
self.obs.register_obs()
|
||||
self.assertEqual(self.obs.api.prj_frozen_enough('openSUSE:Factory:Staging:A'), False)
|
||||
self.assertEqual(True, SelectCommand(self.obs.api).perform('openSUSE:Factory:Staging:A', ['gcc']))
|
||||
self.assertEqual(self.obs.api.prj_frozen_enough('openSUSE:Factory:Staging:A'), True)
|
||||
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)
|
||||
|
||||
@httpretty.activate
|
||||
def test_no_matches(self):
|
||||
self.obs.register_obs()
|
||||
|
||||
# search for requests
|
||||
with self.assertRaises(oscerr.WrongArgs) as cm:
|
||||
SelectCommand(self.obs.api).perform('openSUSE:Factory:Staging:B', ['bash'])
|
||||
|
||||
SelectCommand(self.api).perform('openSUSE:Factory:Staging:B', ['bash'])
|
||||
self.assertEqual(str(cm.exception), "No SR# found for: bash")
|
||||
|
||||
@httpretty.activate
|
||||
def test_selected(self):
|
||||
self.obs.register_obs()
|
||||
# make sure the project is frozen recently for other tests
|
||||
|
||||
self.obs.responses['GET']['/request'] = 'systemd-search-results.xml'
|
||||
ret = SelectCommand(self.obs.api).perform('openSUSE:Factory:Staging:B', ['systemd'])
|
||||
ret = SelectCommand(self.api).perform('openSUSE:Factory:Staging:B', ['wine'])
|
||||
self.assertEqual(True, ret)
|
||||
|
Reference in New Issue
Block a user