2014-06-16 17:15:24 +02:00
|
|
|
import unittest
|
|
|
|
|
2019-04-30 11:44:37 +02:00
|
|
|
from . import obs
|
2014-06-16 17:15:24 +02:00
|
|
|
from osclib.accept_command import AcceptCommand
|
2015-02-19 10:57:55 +01:00
|
|
|
from osclib.conf import Config
|
2014-06-16 17:15:24 +02:00
|
|
|
from osclib.comments import CommentAPI
|
2015-02-19 10:57:55 +01:00
|
|
|
from osclib.stagingapi import StagingAPI
|
2014-06-16 17:15:24 +02:00
|
|
|
|
2014-06-23 15:03:16 +02:00
|
|
|
|
2014-06-16 17:15:24 +02:00
|
|
|
class TestAccept(unittest.TestCase):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
"""
|
|
|
|
Initialize the configuration
|
|
|
|
"""
|
2019-04-30 11:44:37 +02:00
|
|
|
self.obs = obs.OBS()
|
|
|
|
Config(obs.APIURL, 'openSUSE:Factory')
|
|
|
|
self.api = StagingAPI(obs.APIURL, 'openSUSE:Factory')
|
2014-06-16 17:15:24 +02:00
|
|
|
|
|
|
|
def test_accept_comments(self):
|
|
|
|
c_api = CommentAPI(self.api.apiurl)
|
|
|
|
staging_c = 'openSUSE:Factory:Staging:C'
|
|
|
|
comments = c_api.get_comments(project_name=staging_c)
|
|
|
|
|
|
|
|
# Accept staging C (containing apparmor and mariadb)
|
2014-07-31 14:16:28 +02:00
|
|
|
self.assertEqual(True, AcceptCommand(self.api).perform(staging_c))
|
2014-06-16 17:15:24 +02:00
|
|
|
|
|
|
|
# Comments are cleared up
|
|
|
|
accepted_comments = c_api.get_comments(project_name=staging_c)
|
|
|
|
self.assertNotEqual(len(comments), 0)
|
|
|
|
self.assertEqual(len(accepted_comments), 0)
|
|
|
|
|
|
|
|
# But the comment was written at some point
|
|
|
|
self.assertEqual(len(self.obs.comment_bodies), 1)
|
|
|
|
comment = self.obs.comment_bodies[0]
|
2015-02-19 10:57:55 +01:00
|
|
|
self.assertTrue('The following packages have been submitted to openSUSE:Factory' in comment)
|
2014-06-16 17:15:24 +02:00
|
|
|
self.assertTrue('apparmor' in comment)
|
|
|
|
self.assertTrue('mariadb' in comment)
|