예제 #1
0
파일: __init__.py 프로젝트: alunduil/pclean
    def test_write_options_inplace0(self):
        '''write contents with options: in_place[0]'''

        self.mock_parameters.in_place = ''

        write_file('/tmp/pclean.test', self.contents)

        self.mock_open.assert_called_once_with('/tmp/pclean.test', 'w')
예제 #2
0
파일: __init__.py 프로젝트: alunduil/pclean
    def test_write_options_none(self):
        '''write contents with options: none'''

        self.mock_parameters.in_place = None

        write_file('/tmp/pclean.test', self.contents)

        self.assertFalse(self.mock_open.called)
예제 #3
0
파일: __init__.py 프로젝트: alunduil/pclean
    def test_write_options_inplace1(self):
        '''write contents with options: in_place[1]'''

        self.mock_parameters.in_place = '.bak'

        with mock.patch('pclean.os.rename') as mock_rename:
            write_file('/tmp/pclean.test', self.contents)

            mock_rename.assert_called_once_with('/tmp/pclean.test', '/tmp/pclean.test.bak')

        self.mock_open.assert_called_once_with('/tmp/pclean.test', 'w')