Skip to content

Commit

Permalink
modulemd_tools: fix tests for new libmodulemd version 2.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyX committed Jun 13, 2023
1 parent cd04198 commit 0d718ca
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/test_modulemd_tools/test_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def old_libmodulemd():
return Version(Modulemd.get_version()) < Version("2.11.1")


def min_libmodulemd_version(version):
return Version(Modulemd.get_version()) >= Version(version)


class TestYaml(unittest.TestCase):

def test_is_valid(self):
Expand Down Expand Up @@ -57,9 +61,16 @@ def test_create(self):
self.assertEqual(mod1["version"], 2)
self.assertEqual(mod1["data"]["name"], "foo")
self.assertEqual(mod1["data"]["stream"], "stable")
self.assertEqual(mod1["data"]["summary"], None)
self.assertEqual(mod1["data"]["description"], "")
self.assertEqual(mod1["data"]["license"]["module"], [None])

# Between libmodulemd version 2.14.0 and 2.15.0 a change in `None`
# vs empty string happened
if min_libmodulemd_version("2.15.0"):
self.assertEqual(mod1["data"]["summary"], "")
self.assertEqual(mod1["data"]["license"]["module"], [""])
else:
self.assertEqual(mod1["data"]["summary"], None)
self.assertEqual(mod1["data"]["license"]["module"], [None])

def test_update_after_build(self):
"""
Expand Down

0 comments on commit 0d718ca

Please sign in to comment.