Skip to content

Commit

Permalink
Adjust test_notification_rules for a new version of b2sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
mlech-reef committed Nov 27, 2024
1 parent 3e60d2c commit bf4b165
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

env:
PYTHON_DEFAULT_VERSION: "3.12"
INSTALL_SDK_FROM: "git+https://github.com/Backblaze/b2-sdk-python.git@fix-win-perm-handling"

jobs:
lint:
Expand Down Expand Up @@ -78,7 +79,6 @@ jobs:
env:
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
INSTALL_SDK_FROM: "git+https://github.com/Backblaze/b2-sdk-python.git@fix-win-perm-handling"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down
19 changes: 6 additions & 13 deletions test/integration/test_b2_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -3429,10 +3429,8 @@ def test_notification_rules(b2_tool, bucket_name):
if 'writeBucketNotifications' not in auth_dict['allowed']['capabilities']:
pytest.skip('Test account does not have writeBucketNotifications capability')

private_preview_pattern = re.compile(r'FeaturePreviewWarning')
assert b2_tool.should_succeed_json(
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"],
expected_stderr_pattern=private_preview_pattern
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"]
) == []

notification_rule = {
Expand Down Expand Up @@ -3461,8 +3459,7 @@ def test_notification_rules(b2_tool, bucket_name):
"https://example.com/webhook",
"--event-type",
"b2:ObjectCreated:*",
],
expected_stderr_pattern=private_preview_pattern
]
)
expected_rules = [{**notification_rule, "isSuspended": False, "suspensionReason": ""}]
assert_dict_equal_ignore_extra(created_rule, expected_rules[0])
Expand All @@ -3480,8 +3477,7 @@ def test_notification_rules(b2_tool, bucket_name):
"--disable",
"--sign-secret",
secret,
],
expected_stderr_pattern=private_preview_pattern
]
)
expected_rules[0].update({"objectNamePrefix": "prefix", "isEnabled": False})
expected_rules[0]["targetConfiguration"]["hmacSha256SigningSecret"] = secret
Expand All @@ -3490,18 +3486,15 @@ def test_notification_rules(b2_tool, bucket_name):
# read updated rules
assert_dict_equal_ignore_extra(
b2_tool.should_succeed_json(
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"],
expected_stderr_pattern=private_preview_pattern
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"]
),
expected_rules,
)

# delete rule by name
assert b2_tool.should_succeed(
["bucket", "notification-rule", "delete", f"b2://{bucket_name}", "test-rule"],
expected_stderr_pattern=private_preview_pattern
["bucket", "notification-rule", "delete", f"b2://{bucket_name}", "test-rule"]
) == f"Rule 'test-rule' has been deleted from b2://{bucket_name}/\n"
assert b2_tool.should_succeed_json(
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"],
expected_stderr_pattern=private_preview_pattern
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"]
) == []

0 comments on commit bf4b165

Please sign in to comment.