Skip to content

Commit

Permalink
Switch token attribute to be hidden (#1281)
Browse files Browse the repository at this point in the history
The encryption part was removed from the cherry-pick.

fixes #1221

(cherry picked from commit d13c427)
  • Loading branch information
mdellweg committed Nov 16, 2022
1 parent 9744e7d commit b4ebeb9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/1221.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Switched the attribute `token` on `CollectionRemotes` not to be exposed in the API.
1 change: 1 addition & 0 deletions pulp_ansible/app/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class CollectionRemoteSerializer(RemoteSerializer):
allow_null=True,
required=False,
max_length=2000,
write_only=True,
)

sync_dependencies = serializers.BooleanField(
Expand Down
3 changes: 2 additions & 1 deletion pulp_ansible/tests/functional/api/collection/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ def test_update_auth_url(self):
auth_url="https://example.com",
)
remote = self.remote_collection_api.create(body)
self.addCleanup(self.remote_collection_api.delete, remote.pulp_href)
assert not hasattr(remote, "token")
response = self.remote_collection_api.partial_update(remote.pulp_href, {"auth_url": None})
monitor_task(response.task)
response = self.remote_collection_api.partial_update(
remote.pulp_href, {"auth_url": "https://example.com"}
)
monitor_task(response.task)
self.addCleanup(self.remote_collection_api.delete, remote.pulp_href)

def test_auth_url_requires_token(self):
"""Assert that a `CollectionRemote` with `auth_url` and no `token` can't be created."""
Expand Down

0 comments on commit b4ebeb9

Please sign in to comment.