forked from openSUSE/openSUSE-release-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_tests.py
32 lines (24 loc) · 1.09 KB
/
check_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import unittest
from osclib.check_command import CheckCommand
from lxml import etree
from unittest.mock import MagicMock
from . import OBSLocal
H_REPORT = """
-- FAILED Project openSUSE:Factory:Staging:H still needs attention
- 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
"""
class TestCheckCommand(unittest.TestCase):
"""Tests CheckCommand."""
def test_check_command_single(self):
"""Validate json conversion for a single project."""
wf = OBSLocal.FactoryWorkflow()
wf.create_staging('H')
self.checkcommand = CheckCommand(wf.api)
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')
self.assertMultiLineEqual('\n'.join(report).strip(), H_REPORT.strip())