Beispiel #1
0
 def test_deploy_file(self, mock_open):
     source = '/tmp/rule1.cf'
     dest = '/srv/www/saupdate/rule1.cf'
     # mock_shandle = mock.Mock(spec=file)
     # mock_handle = mock.Mock(spec=file)
     # mock_shandle.__iter__.return_value = [
     #     '# Updated: %date%\n',
     #     ''
     # ]
     #
     # def mock_side_e(*args):
     #     "inline"
     #     if args[0] == source:
     #         return mock_shandle
     #     elif args[0] == dest:
     #         return mock_handle
     #     else:
     #         raise ValueError(args[0])
     # mock_open.side_effect = mock_side_e
     deploy_file(source, dest)
     expected_calls = [mock.call(source), mock.call(dest, 'w')]
     self.assertEqual(expected_calls, mock_open.call_args_list)
Beispiel #2
0
 def test_deploy_file(self, mock_open):
     source = '/tmp/rule1.cf'
     dest = '/srv/www/saupdate/rule1.cf'
     # mock_shandle = mock.Mock(spec=file)
     # mock_handle = mock.Mock(spec=file)
     # mock_shandle.__iter__.return_value = [
     #     '# Updated: %date%\n',
     #     ''
     # ]
     #
     # def mock_side_e(*args):
     #     "inline"
     #     if args[0] == source:
     #         return mock_shandle
     #     elif args[0] == dest:
     #         return mock_handle
     #     else:
     #         raise ValueError(args[0])
     # mock_open.side_effect = mock_side_e
     deploy_file(source, dest)
     expected_calls = [mock.call(source), mock.call(dest, 'w')]
     self.assertEqual(expected_calls, mock_open.call_args_list)
 def test_deploy_file(self, mock_open):
     source = '/tmp/rule1.cf'
     dest = '/srv/www/saupdate/rule1.cf'
     deploy_file(source, dest)
     expected_calls = [mock.call(source), mock.call(dest, 'w')]
     self.assertEqual(expected_calls, mock_open.call_args_list)
 def test_deploy_file(self, mock_open):
     source = '/tmp/rule1.cf'
     dest = '/srv/www/saupdate/rule1.cf'
     deploy_file(source, dest)
     expected_calls = [mock.call(source), mock.call(dest, 'w')]
     self.assertEqual(expected_calls, mock_open.call_args_list)