Add an example mmd file into the test database

This will actually be used to test the content generator functionality
This commit is contained in:
Stanislav Ochotnicky
2017-05-04 10:29:33 +02:00
parent 155853fa3c
commit acb59d23f1
3 changed files with 36 additions and 2 deletions

View File

@@ -32,6 +32,7 @@ import modulemd
from module_build_service.utils import get_scm_url_re
import module_build_service.pdc
base_dir = os.path.dirname(__file__)
app = module_build_service.app
conf = init_config(app)
@@ -46,7 +47,8 @@ def init_data():
build_one.stream = '1'
build_one.version = 2
build_one.state = 3
build_one.modulemd = '' # Skipping since no tests rely on it
with open(os.path.join(base_dir, "staged_data", "nginx_mmd.yaml")) as mmd:
build_one.modulemd = mmd.read()
build_one.koji_tag = 'module-nginx-1.2'
build_one.scmurl = ('git://pkgs.domain.local/modules/nginx?'
'#ba95886c7a443b36a9ce31abda1f9bef22f2f8c9')

View File

@@ -0,0 +1,31 @@
# Document type identifier
document: modulemd
# Module metadata format version
version: 1
data:
# Module name, optional
# Typically filled in by the buildsystem, using the VCS repository
# name as the name of the module.
name: nginx
# Module update stream, optional
# Typically filled in by the buildsystem, using the VCS branch name
# as the name of the stream.
stream: 1
# Module version, integer, optional, cannot be negative
# Typically filled in by the buildsystem, using the VCS commit
# timestamp. Module version defines upgrade path for the particular
# update stream.
version: 2
# A short summary describing the module, required
summary: An example nginx module
# A verbose description of the module, required
description: >
A module for the tests of module build service
# Module and content licenses in the Fedora license identifier
# format, required
license:
# Module license, required
# This list covers licenses used for the module metadata, SPEC
# files or extra patches
module:
- MIT

View File

@@ -147,7 +147,8 @@ class TestViews(unittest.TestCase):
data = json.loads(rv.data)
self.assertEquals(data['component_builds'], [1, 2])
self.assertEquals(data['id'], 1)
self.assertEquals(data['modulemd'], '')
with open(path.join(base_dir, "staged_data", "nginx_mmd.yaml")) as mmd:
self.assertEquals(data['modulemd'], mmd.read())
self.assertEquals(data['name'], 'nginx')
self.assertEquals(data['owner'], 'Moe Szyslak')
self.assertEquals(data['scmurl'],