Skip to content

Commit

Permalink
Add UTs
Browse files Browse the repository at this point in the history
  • Loading branch information
mlech-reef committed Dec 18, 2024
1 parent 2c5ebff commit be5ddda
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions test/unit/test_console_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from functools import lru_cache
from io import StringIO
from itertools import chain, product
from tempfile import TemporaryDirectory
from test.helpers import skip_on_windows
from typing import List, Optional
from unittest import mock
Expand Down Expand Up @@ -2210,6 +2211,52 @@ def test_sync_exclude_if_modified_after_exact(self):
]
self._run_command(command, expected_stdout, '', 0)

def test_sync_exclude_if_uploaded_after_in_range(self):
self._authorize_account()
self._create_my_bucket()

with TemporaryDirectory() as temp_dir:
for file, utime in (('test.txt', 1367900664152), ('test2.txt', 1367600664152)):
file_path = self._make_local_file(temp_dir, file)
command = [
'file', 'upload', '--no-progress', '--custom-upload-timestamp',
str(utime), 'my-bucket', file_path, file
]
self._run_command(command, expected_status=0)

with TemporaryDirectory() as temp_dir:
command = [
'sync', '--no-progress', '--exclude-if-uploaded-after', '1367700664.152',
'b2://my-bucket', temp_dir
]
expected_stdout = '''
dnload test2.txt
'''
self._run_command(command, expected_stdout, '', 0)

def test_sync_exclude_if_uploaded_after_exact(self):
self._authorize_account()
self._create_my_bucket()

with TemporaryDirectory() as temp_dir:
for file, utime in (('test.txt', 1367900664152), ('test2.txt', 1367600664152)):
file_path = self._make_local_file(temp_dir, file)
command = [
'file', 'upload', '--no-progress', '--custom-upload-timestamp',
str(utime), 'my-bucket', file_path, file
]
self._run_command(command, expected_status=0)

with TemporaryDirectory() as temp_dir:
command = [
'sync', '--no-progress', '--exclude-if-uploaded-after', '1367600664.152',
'b2://my-bucket', temp_dir
]
expected_stdout = '''
dnload test2.txt
'''
self._run_command(command, expected_stdout, '', 0)

def _test_sync_threads(
self,
threads=None,
Expand Down

0 comments on commit be5ddda

Please sign in to comment.