Skip to content

Commit

Permalink
Added alert for the case that a collection search fails in the manage…
Browse files Browse the repository at this point in the history
… collections popup (#710)

* Added alert for the case that a collection search fails in the collection management popup. Added a test to bring the coverage up to 100% for the search table component. Removed some unused code, the get endpoint function is not used.

* Minor linting error fixes.

* Fixed some backend tests based on the removed/unused functions

* Small fix to test.
  • Loading branch information
downiec authored Jan 16, 2025
1 parent 9aeb52d commit b622c00
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 521 deletions.
6 changes: 0 additions & 6 deletions backend/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from metagrid.api_proxy.views import (
do_citation,
do_globus_auth,
do_globus_get_endpoint,
do_globus_logout,
do_globus_search_endpoints,
do_search,
Expand Down Expand Up @@ -58,11 +57,6 @@ class KeycloakLogin(SocialLoginView):
path("", include("social_django.urls", namespace="social")),
path("proxy/globus-logout/", do_globus_logout, name="globus-logout"),
path("proxy/globus-auth/", do_globus_auth, name="globus-auth"),
path(
"proxy/globus-get-endpoint/",
do_globus_get_endpoint,
name="globus-get-endpoint",
),
path(
"proxy/globus-search-endpoints/",
do_globus_search_endpoints,
Expand Down
8 changes: 0 additions & 8 deletions backend/metagrid/api_proxy/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ def test_globus_auth_begin(self):
)
self.assertEqual(response.status_code, 302)

def test_do_globus_get_endpoint(self):
url = reverse("globus-get-endpoint")

data = {"endpoint_id": "0247816e-cc0d-4e03-a509-10903f6dde11"}
response = self.client.get(url, data)
print(response.status_code)
assert response.status_code == status.HTTP_200_OK

def test_do_globus_search_endpoints(self):
url = reverse("globus-search-endpoints")

Expand Down
21 changes: 0 additions & 21 deletions backend/metagrid/api_proxy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,6 @@ def do_globus_logout(request):
return redirect(homepage_url)


@api_view()
@permission_classes([])
def do_globus_get_endpoint(request):
endpoint_id = request.GET.get("endpoint_id", None)
if request.user.is_authenticated:
tc = load_transfer_client(request.user) # pragma: no cover
else:
client = globus_sdk.ConfidentialAppAuthClient(
settings.SOCIAL_AUTH_GLOBUS_KEY, settings.SOCIAL_AUTH_GLOBUS_SECRET
)
token_response = client.oauth2_client_credentials_tokens()
globus_transfer_data = token_response.by_resource_server[
"transfer.api.globus.org"
]
globus_transfer_token = globus_transfer_data["access_token"]
authorizer = globus_sdk.AccessTokenAuthorizer(globus_transfer_token)
tc = globus_sdk.TransferClient(authorizer=authorizer)
endpoint = tc.get_endpoint(endpoint_id)
return Response(endpoint.data)


@api_view()
@permission_classes([])
def do_globus_search_endpoints(request):
Expand Down
Loading

0 comments on commit b622c00

Please sign in to comment.