kiwi-el8/test/unit/utils/temporary_test.py
Marcus Schäfer 5252e89d6b
Do not expose the delete feature in Temporary
We do not want to expose the ability to create temporary
data that doesn't get auto deleted at the end of its
scope
2021-07-22 15:49:55 +02:00

23 lines
652 B
Python

from mock import patch
from kiwi.utils.temporary import Temporary
class TestTemporary:
def setup(self):
self.temporary = Temporary()
@patch('kiwi.utils.temporary.NamedTemporaryFile')
def test_new_file(self, mock_NamedTemporaryFile):
self.temporary.new_file()
mock_NamedTemporaryFile.assert_called_once_with(
dir='/var/tmp', prefix='kiwi_'
)
@patch('kiwi.utils.temporary.TemporaryDirectory')
def test_new_dir(self, mock_TemporaryDirectory):
self.temporary.new_dir()
mock_TemporaryDirectory.assert_called_once_with(
dir='/var/tmp', prefix='kiwi_'
)