2014-07-08 15:02:12 +02:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from osclib.check_command import CheckCommand
|
|
|
|
|
2019-11-20 15:58:08 +01:00
|
|
|
from lxml import etree
|
2023-03-01 16:57:37 +01:00
|
|
|
from unittest.mock import MagicMock
|
2019-05-04 16:11:51 +02:00
|
|
|
from . import OBSLocal
|
2019-04-21 12:00:26 +02:00
|
|
|
|
2014-07-08 15:02:12 +02:00
|
|
|
H_REPORT = """
|
2018-11-06 11:27:48 +01:00
|
|
|
-- FAILED Project openSUSE:Factory:Staging:H still needs attention
|
2019-11-20 15:58:08 +01:00
|
|
|
- neon: Missing reviews: group:origin-reviewers
|
|
|
|
- Following packages are broken:
|
|
|
|
git (standard): unresolvable
|
|
|
|
- failure check: openqa:kde https://openqa.opensuse.org/tests/1077669#step/dolphin/5
|
2014-07-08 15:02:12 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
class TestCheckCommand(unittest.TestCase):
|
|
|
|
"""Tests CheckCommand."""
|
|
|
|
|
2019-11-20 15:58:08 +01:00
|
|
|
def test_check_command_single(self):
|
|
|
|
"""Validate json conversion for a single project."""
|
|
|
|
|
2021-08-25 12:13:56 +02:00
|
|
|
wf = OBSLocal.FactoryWorkflow()
|
2019-04-21 12:00:26 +02:00
|
|
|
wf.create_staging('H')
|
|
|
|
self.checkcommand = CheckCommand(wf.api)
|
2014-07-08 15:02:12 +02:00
|
|
|
|
2019-11-20 15:58:08 +01:00
|
|
|
with open('tests/fixtures/project/staging_projects/openSUSE:Factory/H.xml', encoding='utf-8') as f:
|
|
|
|
xml = etree.fromstring(f.read())
|
|
|
|
wf.api.project_status = MagicMock(return_value=xml)
|
|
|
|
report = self.checkcommand._check_project('openSUSE:Factory:Staging:H')
|
2018-11-06 11:27:48 +01:00
|
|
|
self.assertMultiLineEqual('\n'.join(report).strip(), H_REPORT.strip())
|