2014-07-08 15:02:12 +02:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from obs import APIURL
|
|
|
|
from obs import OBS
|
2015-02-19 10:57:55 +01:00
|
|
|
from osclib.conf import Config
|
2014-07-08 15:02:12 +02:00
|
|
|
from osclib.check_command import CheckCommand
|
|
|
|
from osclib.stagingapi import StagingAPI
|
|
|
|
|
|
|
|
FULL_REPORT = """
|
2014-07-08 16:54:56 +02:00
|
|
|
++ Acceptable staging project openSUSE:Factory:Staging:A
|
|
|
|
|
|
|
|
++ Acceptable staging project openSUSE:Factory:Staging:C
|
|
|
|
|
2014-07-31 14:16:28 +02:00
|
|
|
-- REVIEW Project openSUSE:Factory:Staging:F still needs attention
|
2014-07-08 15:02:12 +02:00
|
|
|
- yast2-iscsi-client: Missing reviews: factory-repo-checker
|
|
|
|
|
2014-07-31 14:16:28 +02:00
|
|
|
-- REVIEW Project openSUSE:Factory:Staging:G still needs attention
|
2014-07-08 15:02:12 +02:00
|
|
|
- Mesa: Missing reviews: opensuse-review-team
|
|
|
|
|
2014-07-31 14:16:28 +02:00
|
|
|
-- BUILDING Project openSUSE:Factory:Staging:H still needs attention
|
2014-07-08 15:02:12 +02:00
|
|
|
- kiwi: Missing reviews: opensuse-review-team
|
|
|
|
- At least following repositories are still building:
|
2014-07-08 17:06:31 +02:00
|
|
|
standard/i586: building
|
2014-07-08 15:02:12 +02:00
|
|
|
- openQA's overall status is failed for https://openqa.opensuse.org/tests/10660
|
2014-07-09 17:50:06 +02:00
|
|
|
first_boot: fail
|
2014-07-08 15:02:12 +02:00
|
|
|
|
2014-07-31 14:16:28 +02:00
|
|
|
-- REVIEW Project openSUSE:Factory:Staging:J still needs attention
|
2014-07-08 15:02:12 +02:00
|
|
|
- jeuclid: Missing reviews: factory-repo-checker
|
|
|
|
"""
|
|
|
|
|
|
|
|
H_REPORT = """
|
2014-07-31 14:16:28 +02:00
|
|
|
-- BUILDING Project openSUSE:Factory:Staging:H still needs attention
|
2014-07-08 15:02:12 +02:00
|
|
|
- kiwi: Missing reviews: opensuse-review-team
|
|
|
|
- At least following repositories are still building:
|
2014-07-08 17:06:31 +02:00
|
|
|
standard/i586: scheduling
|
|
|
|
standard/x86_64: building
|
|
|
|
images/x86_64: blocked
|
2014-07-08 15:02:12 +02:00
|
|
|
- openQA's overall status is failed for https://openqa.opensuse.org/tests/10660
|
2014-07-09 17:50:06 +02:00
|
|
|
livecdreboot: fail
|
2014-07-08 15:02:12 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
class TestCheckCommand(unittest.TestCase):
|
|
|
|
"""Tests CheckCommand."""
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
"""Initialize the configuration."""
|
|
|
|
|
|
|
|
self.obs = OBS()
|
2018-08-16 21:46:05 -05:00
|
|
|
Config(APIURL, 'openSUSE:Factory')
|
2015-02-19 10:57:55 +01:00
|
|
|
self.stagingapi = StagingAPI(APIURL, 'openSUSE:Factory')
|
2014-07-08 15:02:12 +02:00
|
|
|
self.checkcommand = CheckCommand(self.stagingapi)
|
|
|
|
|
|
|
|
def test_check_command_all(self):
|
|
|
|
"""Validate json conversion for all projects."""
|
|
|
|
report = self.checkcommand._check_project()
|
|
|
|
self.assertEqual('\n'.join(report).strip(), FULL_REPORT.strip())
|
|
|
|
|
|
|
|
def test_check_command_single(self):
|
|
|
|
"""Validate json conversion for a single project."""
|
|
|
|
report = self.checkcommand._check_project('H')
|
|
|
|
self.assertEqual('\n'.join(report).strip(), H_REPORT.strip())
|