Ejemplo n.º 1
0
 def test_creates_flag_file(self, mock_io):
     expected_flag_file = 'bar.bcbiotmp'
     _move_file_with_sizecheck('foo', 'bar')
     transaction.open.assert_called_once_with(expected_flag_file, 'wb')
     transaction.utils.remove_safe.assert_called_once_with(
         expected_flag_file)
Ejemplo n.º 2
0
 def test_fails_if_sizes_arent_equal(self, mock_io):
     transaction.utils.get_size.side_effect = lambda x: x
     with pytest.raises(AssertionError):
         _move_file_with_sizecheck('foo', 'bar')
     assert not transaction.utils.remove_safe.called
Ejemplo n.º 3
0
 def test_moves_files(self, mock_io):
     _move_file_with_sizecheck('foo', 'bar')
     transaction.shutil.move.assert_called_once_with('foo', 'bar')
Ejemplo n.º 4
0
 def test_creates_flag_file(self, mock_io):
     expected_flag_file = 'bar.bcbiotmp'
     _move_file_with_sizecheck('foo', 'bar')
     transaction.open.assert_called_once_with(expected_flag_file, 'wb')
     transaction.utils.remove_safe.assert_called_once_with(
         expected_flag_file)
Ejemplo n.º 5
0
 def test_fails_if_sizes_arent_equal(self, mock_io):
     transaction.utils.get_size.side_effect = lambda x: x
     with pytest.raises(AssertionError):
         _move_file_with_sizecheck('foo', 'bar')
     assert not transaction.utils.remove_safe.called
Ejemplo n.º 6
0
 def test_moves_files(self, mock_io):
     _move_file_with_sizecheck('foo', 'bar')
     transaction.shutil.move.assert_called_once_with('foo', 'bar')