Skip to content

Commit 0e89e9f

Browse files
committed
TT-94 feat: extract http-patch-headers into variable
1 parent 285b486 commit 0e89e9f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

utils/azure_users.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ def __init__(self, id, name, email, role):
4545
self.role = role
4646

4747

48+
HTTP_PATCH_HEADERS = {
49+
'Content-type': 'application/json',
50+
'Accept': 'application/json',
51+
}
52+
53+
4854
class AzureConnection:
4955
def __init__(self, config=MSConfig):
5056
self.client = msal.ConfidentialClientApplication(
@@ -78,10 +84,6 @@ def users(self) -> List[AzureUser]:
7884
return [self.to_azure_user(item) for item in response.json()['value']]
7985

8086
def update_user_role(self, id, role):
81-
headers = {
82-
'Content-type': 'application/json',
83-
'Accept': 'application/json',
84-
}
8587
endpoint = "{endpoint}/users/{user_id}?api-version=1.6".format(
8688
endpoint=self.config.ENDPOINT, user_id=id
8789
)
@@ -90,7 +92,7 @@ def update_user_role(self, id, role):
9092
endpoint,
9193
auth=BearerAuth(self.access_token),
9294
data=json.dumps(data),
93-
headers=headers,
95+
headers=HTTP_PATCH_HEADERS,
9496
)
9597
assert 204 == response.status_code
9698

0 commit comments

Comments
 (0)