From acb59d23f17ac79f207a308661ec7876a6aba45e Mon Sep 17 00:00:00 2001 From: Stanislav Ochotnicky Date: Thu, 4 May 2017 10:29:33 +0200 Subject: [PATCH] Add an example mmd file into the test database This will actually be used to test the content generator functionality --- tests/__init__.py | 4 +++- tests/staged_data/nginx_mmd.yaml | 31 +++++++++++++++++++++++++++++++ tests/test_views/test_views.py | 3 ++- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 tests/staged_data/nginx_mmd.yaml diff --git a/tests/__init__.py b/tests/__init__.py index c9f85803..a22817f2 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -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') diff --git a/tests/staged_data/nginx_mmd.yaml b/tests/staged_data/nginx_mmd.yaml new file mode 100644 index 00000000..98911d0b --- /dev/null +++ b/tests/staged_data/nginx_mmd.yaml @@ -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 diff --git a/tests/test_views/test_views.py b/tests/test_views/test_views.py index d923d536..60c8f9d2 100644 --- a/tests/test_views/test_views.py +++ b/tests/test_views/test_views.py @@ -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'],