Skip to content

Commit

Permalink
union with Nonetype breaks older python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
zackverham committed Sep 12, 2024
1 parent 9f7b0f4 commit 20324d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion integration/tests/posit/connect/oauth/test_associations.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ def test_find_update_by_content(self):
)

# unset content association
self.content.oauth.associations.update(None)
self.content.oauth.associations.delete()
no_associations = self.content.oauth.associations.find()
assert len(no_associations) == 0
18 changes: 13 additions & 5 deletions src/posit/connect/oauth/associations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""OAuth association resources."""

from os import walk
from typing import List

from ..resources import Resource, ResourceParameters, Resources
Expand Down Expand Up @@ -65,12 +66,19 @@ def find(self) -> List[Association]:
for result in response.json()
]

def update(self, integration_guid: None | str) -> None:
def delete(self) -> None:
"""Delete integration associations."""
data = []

path = (
f"v1/content/{self.content_guid}/oauth/integrations/associations"
)
url = self.params.url + path
self.params.session.put(url, json=data)

def update(self, integration_guid: str) -> None:
"""Set integration associations."""
if integration_guid is None:
data = []
else:
data = [{"oauth_integration_guid": integration_guid}]
data = [{"oauth_integration_guid": integration_guid}]

path = (
f"v1/content/{self.content_guid}/oauth/integrations/associations"
Expand Down

0 comments on commit 20324d1

Please sign in to comment.