pkgset: Use release number of a module

Signed-off-by: Martin Curlej <mcurlej@redhat.com>

updated regex, added comment, pep8 fix
This commit is contained in:
Martin Curlej 2017-06-20 16:26:30 +02:00
parent 65bc6969e2
commit 079454c502
2 changed files with 47 additions and 4 deletions

View file

@ -6,6 +6,7 @@ import os
import sys
import unittest
import json
import re
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
@ -198,5 +199,28 @@ class TestSourceKoji(helpers.PungiTestCase):
[mock.call('koji')])
class TestCorrectNVR(helpers.PungiTestCase):
def setUp(self):
super(TestCorrectNVR, self).setUp()
self.nv = "base-runtime-f26"
self.nvr = "base-runtime-f26-20170502134116"
self.release_regex = re.compile("^(\d){14}$")
def test_nv(self):
module_info = source_koji.variant_dict_from_str(self.nv)
expectedKeys = ["variant_version", "variant_id", "variant_type"]
self.assertItemsEqual(module_info.keys(), expectedKeys)
def test_nvr(self):
module_info = source_koji.variant_dict_from_str(self.nvr)
expectedKeys = ["variant_version", "variant_id", "variant_type", "variant_release"]
self.assertItemsEqual(module_info.keys(), expectedKeys)
def test_correct_release(self):
module_info = source_koji.variant_dict_from_str(self.nvr)
self.assertIsNotNone(self.release_regex.match(module_info["variant_release"]))
if __name__ == "__main__":
unittest.main()