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)
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
def test_moves_files(self, mock_io): _move_file_with_sizecheck('foo', 'bar') transaction.shutil.move.assert_called_once_with('foo', 'bar')
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)
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
def test_moves_files(self, mock_io): _move_file_with_sizecheck('foo', 'bar') transaction.shutil.move.assert_called_once_with('foo', 'bar')