Add first unit test so we can start collecting coverage
This commit is contained in:
parent
aa0067e32c
commit
fe461f480e
23
tests/pylorax/test_buildstamp.py
Normal file
23
tests/pylorax/test_buildstamp.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import io
|
||||||
|
import unittest
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from pylorax import buildstamp
|
||||||
|
|
||||||
|
class BuildStampTestCase(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.bstamp = buildstamp.BuildStamp(
|
||||||
|
'Lorax Tests',
|
||||||
|
'0.1',
|
||||||
|
'https://github.com/rhinstaller/lorax/issues',
|
||||||
|
True,
|
||||||
|
'noarch'
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_write_produces_file_with_expected_content(self):
|
||||||
|
out_file = io.StringIO()
|
||||||
|
with patch.object(out_file, 'close'):
|
||||||
|
with patch.object(buildstamp, 'open', return_value=out_file):
|
||||||
|
self.bstamp.write('/tmp/stamp.ini')
|
||||||
|
self.assertIn("[Main]\nProduct=Lorax Tests\nVersion=0.1\nBugURL=https://github.com/rhinstaller/lorax/issues\nIsFinal=True", out_file.getvalue())
|
||||||
|
self.assertIn("[Compose]\nLorax=devel", out_file.getvalue())
|
Loading…
Reference in New Issue
Block a user