Skip to content

Commit 173caea

Browse files
test(scope): Add unit test for Scope.set_tags
1 parent aa384f3 commit 173caea

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

tests/test_scope.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,3 +796,29 @@ def test_should_send_default_pii_false(sentry_init):
796796
sentry_init(send_default_pii=False)
797797

798798
assert should_send_default_pii() is False
799+
800+
801+
def test_set_tags():
802+
scope = Scope()
803+
scope.set_tags({"tag1": "value1", "tag2": "value2"})
804+
event = scope.apply_to_event({}, {})
805+
806+
assert event["tags"] == {"tag1": "value1", "tag2": "value2"}, "Setting tags failed"
807+
808+
scope.set_tags({"tag2": "updated", "tag3": "new"})
809+
event = scope.apply_to_event({}, {})
810+
811+
assert event["tags"] == {
812+
"tag1": "value1",
813+
"tag2": "updated",
814+
"tag3": "new",
815+
}, "Updating tags failed"
816+
817+
scope.set_tags({})
818+
event = scope.apply_to_event({}, {})
819+
820+
assert event["tags"] == {
821+
"tag1": "value1",
822+
"tag2": "updated",
823+
"tag3": "new",
824+
}, "Upating tags with empty dict changed tags"

0 commit comments

Comments
 (0)