Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adal-chiriliuc-reef committed Apr 25, 2024
1 parent 7c94990 commit 28120de
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions test/integration/test_b2_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -1996,6 +1996,17 @@ def test_file_lock(
['file', 'upload', '--no-progress', '--quiet', lock_enabled_bucket_name, sample_file, 'a']
)

update_file_retention_deprecated_pattern = re.compile(
re.escape(
'WARNING: `update-file-retention` command is deprecated. Use `file update` instead.'
)
)
update_file_legal_hold_deprecated_pattern = re.compile(
re.escape(
'WARNING: `update-file-legal-hold` command is deprecated. Use `file update` instead.'
)
)

b2_tool.should_fail(
[
'update-file-retention', not_lockable_file['fileName'], not_lockable_file['fileId'],
Expand All @@ -2006,7 +2017,8 @@ def test_file_lock(

b2_tool.should_succeed( # first let's try with a file name
['update-file-retention', lockable_file['fileName'], lockable_file['fileId'], 'governance',
'--retain-until', str(now_millis + ONE_DAY_MILLIS + ONE_HOUR_MILLIS)]
'--retain-until', str(now_millis + ONE_DAY_MILLIS + ONE_HOUR_MILLIS)],
expected_stderr_pattern=update_file_retention_deprecated_pattern,
)

_assert_file_lock_configuration(
Expand All @@ -2018,7 +2030,8 @@ def test_file_lock(

b2_tool.should_succeed( # and now without a file name
['update-file-retention', lockable_file['fileId'], 'governance',
'--retain-until', str(now_millis + ONE_DAY_MILLIS + 2 * ONE_HOUR_MILLIS)]
'--retain-until', str(now_millis + ONE_DAY_MILLIS + 2 * ONE_HOUR_MILLIS)],
expected_stderr_pattern=update_file_retention_deprecated_pattern,
)

_assert_file_lock_configuration(
Expand All @@ -2043,6 +2056,7 @@ def test_file_lock(
'governance', '--retain-until',
str(now_millis + ONE_HOUR_MILLIS), '--bypass-governance'
],
expected_stderr_pattern=update_file_retention_deprecated_pattern,
)

_assert_file_lock_configuration(
Expand All @@ -2062,6 +2076,7 @@ def test_file_lock(
'update-file-retention', lockable_file['fileName'], lockable_file['fileId'], 'none',
'--bypass-governance'
],
expected_stderr_pattern=update_file_retention_deprecated_pattern,
)

_assert_file_lock_configuration(
Expand All @@ -2075,12 +2090,14 @@ def test_file_lock(

b2_tool.should_succeed( # first let's try with a file name
['update-file-legal-hold', lockable_file['fileName'], lockable_file['fileId'], 'on'],
expected_stderr_pattern=update_file_legal_hold_deprecated_pattern,
)

_assert_file_lock_configuration(b2_tool, lockable_file['fileId'], legal_hold=LegalHold.ON)

b2_tool.should_succeed( # and now without a file name
['update-file-legal-hold', lockable_file['fileId'], 'off'],
expected_stderr_pattern=update_file_legal_hold_deprecated_pattern,
)

_assert_file_lock_configuration(b2_tool, lockable_file['fileId'], legal_hold=LegalHold.OFF)
Expand Down

0 comments on commit 28120de

Please sign in to comment.