openSUSE-release-tools/tests/accept_tests.py
Jimmy Berry 6069245350 Remove SUSE copyright, warranty, and license headers.
Distinct copyrights were left as I do not wish to track down commit
history to ensure it properly documents the copyright holders. Also left
non-GPLv2 licenses and left bs_copy untouched as a mirror from OBS.

Already have a mix of with and without headers and even OBS does not place
on majority of files. If SUSE lawyers have an issue it will come up in
legal review for Factory.
2018-08-23 19:18:06 -05:00

40 lines
1.3 KiB
Python

import unittest
from obs import APIURL
from obs import OBS
from osclib.accept_command import AcceptCommand
from osclib.conf import Config
from osclib.comments import CommentAPI
from osclib.stagingapi import StagingAPI
class TestAccept(unittest.TestCase):
def setUp(self):
"""
Initialize the configuration
"""
self.obs = OBS()
Config(APIURL, 'openSUSE:Factory')
self.api = StagingAPI(APIURL, 'openSUSE:Factory')
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)
self.assertEqual(True, AcceptCommand(self.api).perform(staging_c))
# 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]
self.assertTrue('The following packages have been submitted to openSUSE:Factory' in comment)
self.assertTrue('apparmor' in comment)
self.assertTrue('mariadb' in comment)