summaryrefslogtreecommitdiff
path: root/test/test_repo_flags.py
blob: d9b8642f1bfb2163a512c1366c10384a7f679bb6 (plain)
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
33
34
35
36
37
38
39
40
41
42
43
import pytest
from obsapi.repoflags import RepoFlags

xml1 = """<project name="home:sbahling:obsapi:test">
  <title>Test project for obsapi unit tests</title>
  <description/>
  <person userid="sbahling" role="maintainer"/>
  <repository name="SLE_15_SP1">
    <path project="SUSE:SLE-15-SP1:GA" repository="standard"/>
    <arch>x86_64</arch>
  </repository>
  <repository name="SLE_12_SP3">
    <path project="SUSE:SLE-12-SP3:GA" repository="standard"/>
    <arch>x86_64</arch>
  </repository>
</project>"""


xml2 = """<package name="suse-hello-1.0" project="home:sbahling:obsapi:test">
  <title>Example from Kernel Module Packages Manual</title>
  <description/>
  <build>
    <enable arch="x86_64" repository="SLE_12_SP3"/>
    <disable/>
  </build>
  <debuginfo>
    <enable/>
  </debuginfo>
  <useforbuild>
    <disable arch="x86_64" repository="SLE_15_SP1"/>
  </useforbuild>
</package>"""

flag_types = ['build', 'publish', 'useforbuild', 'debuginfo']


def test_flag_types():
    repoflags = RepoFlags(xml2)
    flag_types = repoflags.flag_types
    assert len(flag_types) == 3
    assert 'build' in flag_types
    assert 'useforbuild' in flag_types
    assert 'debuginfo' in flag_types