|
13 | 13 | from sentry.constants import RESERVED_PROJECT_SLUGS, ObjectStatus
|
14 | 14 | from sentry.dynamic_sampling import DEFAULT_BIASES, RuleType
|
15 | 15 | from sentry.dynamic_sampling.rules.base import NEW_MODEL_THRESHOLD_IN_MINUTES
|
| 16 | +from sentry.issues.highlights import get_highlight_preset_for_project |
16 | 17 | from sentry.models.apitoken import ApiToken
|
17 | 18 | from sentry.models.auditlogentry import AuditLogEntry
|
18 | 19 | from sentry.models.deletedproject import DeletedProject
|
@@ -837,6 +838,48 @@ def test_safe_fields(self):
|
837 | 838 | 'Invalid syntax near "er ror" (line 1),\nDeep wildcard used more than once (line 2)',
|
838 | 839 | ]
|
839 | 840 |
|
| 841 | + def test_highlights(self): |
| 842 | + # Default with or without flag, ignore update attempt |
| 843 | + highlight_context = ["red", "robin"] |
| 844 | + highlight_tags = ["bears", "beets", "battlestar_galactica"] |
| 845 | + resp = self.get_success_response( |
| 846 | + self.org_slug, |
| 847 | + self.proj_slug, |
| 848 | + highlightContext=highlight_context, |
| 849 | + highlightTags=highlight_tags, |
| 850 | + ) |
| 851 | + assert self.project.get_option("sentry:highlight_context") is None |
| 852 | + assert self.project.get_option("sentry:highlight_tags") is None |
| 853 | + |
| 854 | + preset = get_highlight_preset_for_project(self.project) |
| 855 | + assert resp.data["highlightContext"] == preset["context"] |
| 856 | + assert resp.data["highlightTags"] == preset["tags"] |
| 857 | + |
| 858 | + with self.feature("organizations:event-tags-tree-ui"): |
| 859 | + # Set to custom |
| 860 | + resp = self.get_success_response( |
| 861 | + self.org_slug, |
| 862 | + self.proj_slug, |
| 863 | + highlightContext=highlight_context, |
| 864 | + highlightTags=highlight_tags, |
| 865 | + ) |
| 866 | + assert self.project.get_option("sentry:highlight_context") == highlight_context |
| 867 | + assert self.project.get_option("sentry:highlight_tags") == highlight_tags |
| 868 | + assert resp.data["highlightContext"] == highlight_context |
| 869 | + assert resp.data["highlightTags"] == highlight_tags |
| 870 | + |
| 871 | + # Set to empty |
| 872 | + resp = self.get_success_response( |
| 873 | + self.org_slug, |
| 874 | + self.proj_slug, |
| 875 | + highlightContext=[], |
| 876 | + highlightTags=[], |
| 877 | + ) |
| 878 | + assert self.project.get_option("sentry:highlight_context") == [] |
| 879 | + assert self.project.get_option("sentry:highlight_tags") == [] |
| 880 | + assert resp.data["highlightContext"] == [] |
| 881 | + assert resp.data["highlightTags"] == [] |
| 882 | + |
840 | 883 | def test_store_crash_reports(self):
|
841 | 884 | resp = self.get_success_response(self.org_slug, self.proj_slug, storeCrashReports=10)
|
842 | 885 | assert self.project.get_option("sentry:store_crash_reports") == 10
|
|
0 commit comments