2017-05-02 18:11:40 -05:00
|
|
|
import unittest
|
|
|
|
from osclib.conf import Config
|
|
|
|
from osclib.stagingapi import StagingAPI
|
2019-04-21 12:00:26 +02:00
|
|
|
from osclib.select_command import SelectCommand
|
2017-05-02 18:11:40 -05:00
|
|
|
from osclib.unselect_command import UnselectCommand
|
2019-04-21 12:00:26 +02:00
|
|
|
from osclib.core import package_list_without_links
|
2019-05-02 08:14:44 +02:00
|
|
|
from . import OBSLocal
|
2017-05-02 18:11:40 -05:00
|
|
|
|
2019-05-02 08:14:44 +02:00
|
|
|
class TestUnselect(OBSLocal.TestCase):
|
2017-05-02 18:11:40 -05:00
|
|
|
|
|
|
|
def test_cleanup_filter(self):
|
2019-05-04 16:11:51 +02:00
|
|
|
wf = OBSLocal.StagingWorkflow()
|
2019-04-21 12:00:26 +02:00
|
|
|
UnselectCommand.config_init(wf.api)
|
2018-11-10 11:30:02 +01:00
|
|
|
UnselectCommand.cleanup_days = 1
|
2019-04-21 12:00:26 +02:00
|
|
|
obsolete = wf.api.project_status_requests('obsolete', UnselectCommand.filter_obsolete)
|
|
|
|
self.assertSequenceEqual([], obsolete)
|
|
|
|
|
|
|
|
def test_free_staging(self):
|
2019-05-04 16:11:51 +02:00
|
|
|
wf = OBSLocal.StagingWorkflow()
|
2019-04-21 12:00:26 +02:00
|
|
|
wf.setup_rings()
|
|
|
|
|
|
|
|
staging_a = wf.create_staging('A', freeze=True)
|
|
|
|
winerq = wf.create_submit_request('devel:wine', 'wine')
|
|
|
|
self.assertEqual(True, SelectCommand(wf.api, staging_a.name).perform(['wine']))
|
|
|
|
self.assertEqual(['wine'], package_list_without_links(wf.apiurl, staging_a.name))
|
|
|
|
|
|
|
|
uc = UnselectCommand(wf.api)
|
|
|
|
self.assertIsNone(uc.perform(['wine']))
|
|
|
|
|
|
|
|
self.assertEqual([], package_list_without_links(wf.apiurl, staging_a.name))
|