File tree Expand file tree Collapse file tree 5 files changed +16
-19
lines changed
tests/unit/integrations/gitlab Expand file tree Collapse file tree 5 files changed +16
-19
lines changed Original file line number Diff line number Diff line change 66from django .db .models import Q
77from django .utils .formats import get_format
88
9- from core .helpers import get_current_site_url
109from features .models import Feature , FeatureState , FeatureStateValue
1110from integrations .github .constants import (
12- DELETED_FEATURE_TEXT ,
13- DELETED_SEGMENT_OVERRIDE_TEXT ,
14- FEATURE_ENVIRONMENT_URL ,
15- FEATURE_TABLE_HEADER ,
16- FEATURE_TABLE_ROW ,
1711 GITHUB_TAG_COLOR ,
18- LINK_FEATURE_TITLE ,
19- LINK_SEGMENT_TITLE ,
2012 UNLINKED_FEATURE_TEXT ,
21- UPDATED_FEATURE_TEXT ,
2213 GitHubEventType ,
2314 GitHubTag ,
2415 github_tag_description ,
Original file line number Diff line number Diff line change @@ -29,9 +29,7 @@ def map_feature_states_to_dicts(
2929 env_data ["last_updated" ] = feature_state .updated_at .strftime (
3030 get_format ("DATETIME_INPUT_FORMATS" )[0 ]
3131 )
32- env_data ["environment_api_key" ] = (
33- feature_state .environment .api_key # type: ignore[union-attr]
34- )
32+ env_data ["environment_api_key" ] = feature_state .environment .api_key # type: ignore[union-attr]
3533
3634 if (
3735 hasattr (feature_state , "feature_segment" )
Original file line number Diff line number Diff line change @@ -153,7 +153,9 @@ def dispatch_gitlab_comment(
153153 "feature_name" : feature .name ,
154154 "event_type" : event_type ,
155155 "feature_states" : feature_states_data ,
156- "url" : url if event_type == GitLabEventType .FEATURE_EXTERNAL_RESOURCE_REMOVED .value else None ,
156+ "url" : url
157+ if event_type == GitLabEventType .FEATURE_EXTERNAL_RESOURCE_REMOVED .value
158+ else None ,
157159 "segment_name" : segment_name ,
158160 },
159161 )
Original file line number Diff line number Diff line change 1414UNLINKED_FEATURE_TEXT = "**The feature flag `%s` was unlinked from the issue/MR**"
1515
1616
17- def _parse_resource_url (resource_url : str ) -> tuple [str , GitLabResourceEndpoint , int ] | None :
17+ def _parse_resource_url (
18+ resource_url : str ,
19+ ) -> tuple [str , GitLabResourceEndpoint , int ] | None :
1820 """Parse a GitLab resource URL into (project_path, resource_type, iid).
1921
2022 Returns None if the URL format is not recognised.
@@ -69,9 +71,7 @@ def post_gitlab_comment(
6971 deleted_at__isnull = True ,
7072 )
7173 except GitLabConfiguration .DoesNotExist :
72- logger .warning (
73- "No GitLabConfiguration found for project_id=%s" , project_id
74- )
74+ logger .warning ("No GitLabConfiguration found for project_id=%s" , project_id )
7575 return
7676
7777 if not gitlab_config .gitlab_project_id :
Original file line number Diff line number Diff line change @@ -99,7 +99,10 @@ def test_gitlab_webhook__invalid_token__returns_400(
9999 url ,
100100 data = "{}" ,
101101 content_type = "application/json" ,
102- ** {"HTTP_X_GITLAB_TOKEN" : "wrong-secret" , "HTTP_X_GITLAB_EVENT" : "Merge Request Hook" }, # type: ignore[arg-type]
102+ ** {
103+ "HTTP_X_GITLAB_TOKEN" : "wrong-secret" ,
104+ "HTTP_X_GITLAB_EVENT" : "Merge Request Hook" ,
105+ }, # type: ignore[arg-type]
103106 )
104107
105108 # Then
@@ -120,7 +123,10 @@ def test_gitlab_webhook__missing_config__returns_404(
120123 url ,
121124 data = "{}" ,
122125 content_type = "application/json" ,
123- ** {"HTTP_X_GITLAB_TOKEN" : "some-secret" , "HTTP_X_GITLAB_EVENT" : "Merge Request Hook" }, # type: ignore[arg-type]
126+ ** {
127+ "HTTP_X_GITLAB_TOKEN" : "some-secret" ,
128+ "HTTP_X_GITLAB_EVENT" : "Merge Request Hook" ,
129+ }, # type: ignore[arg-type]
124130 )
125131
126132 # Then
You can’t perform that action at this time.
0 commit comments