blob: c8b7ec64c2adf094f76b0eadcb824d25a727ea1f (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
from obsapi.sourceapi import ObsSourceApi
import os
prj = 'home:sbahling:obsapi:test'
pkg = 'suse-hello-1.0'
repo = 'SLE_12_SP3'
arch = 'x86_64'
sourceapi = ObsSourceApi(apiurl='https://api.opensuse.org')
modpath = os.path.dirname(os.path.realpath(__file__))
def test_source_put_meta():
prj = 'home:sbahling:obsapi:t1'
with open(os.path.join(modpath, 'obsapi_test_prj_meta.xml')) as f:
xml = f.read().replace('__PRJ__', prj)
response = sourceapi.put_meta(prj, xml)
assert '<status code="ok">' in response.content
def test_source_get_prj():
xml = sourceapi.get(prj)
assert '<entry name="suse-hello-1.0"/>' in xml
def test_source_get_pkg():
xml = sourceapi.get(prj, pkg)
assert '<directory name="suse-hello-1.0"' in xml
def test_source_get_file():
source_file = sourceapi.get(prj, pkg, 'COPYING')
assert 'GNU GENERAL PUBLIC LICENSE' in source_file
def test_source_get_meta_prj():
xml = sourceapi.get_meta(prj)
assert '<project name="{}">'.format(prj) in xml
def test_source_get_meta_pkg():
xml = sourceapi.get_meta(prj, pkg)
assert '<package name="{}" project="{}">'.format(pkg, prj) in xml
def test_source_get_prj_attributes():
xml = sourceapi.get_attribute(prj)
assert '<attributes>' in xml
def test_source_get_prj_attribute():
xml = sourceapi.get_attribute(prj, attribute='OBS:Screenshots')
assert '<attributes>' in xml
assert 'name="Screenshots"' in xml
assert 'namespace="OBS"' in xml
def test_source_get_pkg_attributes():
xml = sourceapi.get_attribute(prj, pkg)
assert '<attributes>' in xml
assert 'name="Screenshots"' in xml
assert 'namespace="OBS"' in xml
def test_source_get_prj_config():
config = sourceapi.get_config(prj)
assert 'Macros:' in config
def test_source_get_prj_pubkey():
pubkey = sourceapi.get_pubkey(prj)
assert '-BEGIN PGP PUBLIC KEY BLOCK-' in pubkey
def test_source_get_history():
xml = sourceapi.get_history(prj, pkg)
assert '<revisionlist>' in xml
|