Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
d3a2a1e
cors proxy causing issues
lisi-w Aug 12, 2021
f04dfc4
added node modules
lisi-w Aug 24, 2021
61e19b4
Minor changes for tests, the Globus link and error message for globus.
downiec Sep 3, 2021
380f2a6
Rebased and fixed minor warning issues.
downiec Sep 3, 2021
7feed88
Removed some console statements, and globus downloads open a new tab …
downiec Sep 14, 2021
8aaa0ac
Updated the front-end UI to only show the globus option if it is avai…
downiec Sep 16, 2021
43a1ddd
resolved
sashakames Apr 4, 2022
68f88cd
fix style
sashakames Apr 5, 2022
7b22ab3
wget changes
sashakames Apr 14, 2022
0117458
Bumped version number.
downiec Jul 12, 2022
a16966b
Changes to fix wget download issues. (#452)
downiec Jul 21, 2022
bd5c708
Update dependency @types/jest to v28.1.6 (#444)
renovate[bot] Jul 21, 2022
f77d9f2
Update typescript-eslint monorepo to v5.30.7 (#445)
renovate[bot] Jul 21, 2022
84e34ff
Update dependency moment to v2.29.4 [SECURITY] (#443)
renovate[bot] Jul 21, 2022
0828253
Bump terser from 5.12.1 to 5.14.2 in /frontend (#451)
dependabot[bot] Jul 21, 2022
a8ef02b
Bump moment from 2.29.2 to 2.29.4 in /frontend (#442)
dependabot[bot] Jul 21, 2022
ceabada
Merge branch 'master' into v1.0.7
downiec Jul 21, 2022
9535040
resolved
sashakames Jul 22, 2022
8364e76
primarily reconciling the wget refactor with token/simple functionality
sashakames Jul 25, 2022
1869e8d
remove node_modules (mistake)
sashakames Jul 25, 2022
e3963b5
Merge branch 'v1.0.7' into wget-simple
sashakames Jul 25, 2022
a8f41e7
proxy endpoint for globus script
sashakames Jul 25, 2022
d811604
Merge branch 'wget-simple' of https://github.com/aims-group/metagrid …
sashakames Jul 25, 2022
7bd22e0
fix let url and ApiRoute issues, formatting
sashakames Jul 26, 2022
3cbcb7f
refactor proxy api to use environment-based settings
sashakames Jul 27, 2022
bf4ecae
add env vars
sashakames Aug 1, 2022
d213352
Feature/453 update deployment configs (#458)
downiec Aug 19, 2022
6876087
fix typo
sashakames Aug 29, 2022
02ea9df
resolve
sashakames Aug 29, 2022
23aaf28
setting naming overhaul
sashakames Aug 30, 2022
ea4a082
Feature/459 expand all button facets (#464)
downiec Aug 30, 2022
ce8accd
Merge branch 'v1.0.7' into merge-wget-simple
sashakames Aug 31, 2022
473e869
update and correct with comment out
sashakames Sep 2, 2022
baa3ce8
Merge branch 'master' into wget-simple
sashakames Sep 2, 2022
4b9b10e
update settings names
downiec Sep 8, 2022
34cdc21
update envs, fix style
sashakames Sep 14, 2022
a98478b
restoring wget settings
sashakames Sep 14, 2022
478b057
fix globus url issues
sashakames Sep 16, 2022
21325e1
got tests to pass on frontend, isort
sashakames Sep 19, 2022
e8e0f99
fix env var name
downiec Sep 20, 2022
aa43007
Merge branch 'wget-simple' of https://github.com/aims-group/metagrid …
downiec Sep 20, 2022
705ec4c
for now whitelist citations to only the DRKZ server
sashakames Sep 20, 2022
3c8d8aa
Merge remote-tracking branch 'origin/citation_patch' into wget-simple
sashakames Sep 21, 2022
79e1a5d
change isort order
sashakames Sep 21, 2022
0c6ee92
fix isort, test code
sashakames Sep 21, 2022
561c320
fix assert
sashakames Sep 21, 2022
683e40f
Merge branch 'wget-simple' of https://github.com/aims-group/metagrid …
downiec Sep 22, 2022
a74c9f7
Merge branch 'citation_patch' into wget-simple
sashakames Sep 22, 2022
1e47986
fix the errors: linter, args, authState placement
sashakames Sep 22, 2022
9abbe36
Incrementing version number for next set of minor updates.
downiec Sep 23, 2022
3f659f4
Pin dependencies (#461)
renovate[bot] Sep 23, 2022
df1fe81
Update dependency @types/jest to v28.1.8 (#462)
renovate[bot] Sep 23, 2022
f96469b
Merge branch 'wget-simple' of https://github.com/aims-group/metagrid …
downiec Sep 29, 2022
1ca91c0
fix the errors: linter, args, authState placement
sashakames Sep 22, 2022
30648a3
delete ws
sashakames Sep 29, 2022
aabf1bd
resolved
sashakames Sep 29, 2022
d115b94
resolve
sashakames Sep 29, 2022
d755c9f
resolve
sashakames Sep 29, 2022
bb2af05
Merge branch 'wget-simple' of https://github.com/aims-group/metagrid …
sashakames Sep 29, 2022
81b6b37
Merge branch 'wget-simple' of https://github.com/aims-group/metagrid …
downiec Sep 29, 2022
80de819
resolve all merge conficts
sashakames Oct 4, 2022
bdce38a
Merge branch 'wget-simple' of https://github.com/aims-group/metagrid …
downiec Oct 4, 2022
6a22921
pre-commit ran black to fix
sashakames Oct 4, 2022
9d4fc4a
Support backend settings in config (#482)
sashakames Oct 13, 2022
6c029e3
Update react monorepo to v18 (#478)
renovate[bot] Oct 14, 2022
7b35d06
Pin dependencies (#477)
renovate[bot] Oct 19, 2022
749bdb3
fix warnings issues
sashakames Oct 24, 2022
ce03fb7
Removed some config settings
downiec Oct 25, 2022
42493be
Removed extraneous files from the root directory.
downiec Oct 25, 2022
9bad38b
Fixed tiny flake8 complaint
downiec Oct 25, 2022
31f34d7
hotfix to the last update so that local containers have the required …
downiec Oct 27, 2022
9f95688
Update .django
sashakames Nov 2, 2022
7d50069
Updating a few dependencies in the backend
downiec Mar 17, 2023
f0fee9a
Updating the Flake8 pre-commit config file to see if that resolves pr…
downiec Mar 17, 2023
c01f64d
Fixed typo in .coveragerc which caused migrations to be included in t…
downiec Mar 17, 2023
086dc61
Upgraded to Django 4.1.7, along with some other python packages.
downiec Mar 17, 2023
a071e6a
Upgraded more python packages while testing to make sure nothing breaks.
downiec Mar 17, 2023
5d43c9c
Reverted dj-rest-auth as it caused issues with tests failing (althoug…
downiec Mar 17, 2023
7510ad6
Updated dj-rest-auth to latest (before breaking changes)
downiec Mar 17, 2023
55158b0
Updating front-end to use the latest react-router-dom major version 6
downiec Mar 22, 2023
e44285f
Removed some comments and updated some tests. Tests still failing, ne…
downiec Mar 22, 2023
113c68a
Updated tests to use memory router to account for the useNavigate cha…
downiec Mar 29, 2023
5e59985
Updated some more frontend packages, however a few updates are breaki…
downiec Mar 29, 2023
119d5a9
Updated yarn.lock file to see if tests pass.
downiec Mar 29, 2023
5e49c80
Feature/500 info notifications (#520)
downiec May 5, 2023
ff49790
Feature/500 info notifications (#523)
downiec May 5, 2023
c91161b
Merged the globus_dev_demo branch with the latest v1.0.8 branch. Perf…
downiec May 12, 2023
55830d8
Added mip_era and data_node facets to the input4mips project.
downiec May 12, 2023
cf20f53
Updated the general facet order for input 4 mips
downiec May 16, 2023
b08d9bf
Merge branch 'v1.0.8' into globus_dev_demo
downiec May 18, 2023
cdcf4c7
Fixed the issue with incorrect search URL and updated files so config…
downiec May 19, 2023
6ff8b6a
Updated yarn.lock file
downiec May 19, 2023
ac11369
Removed some commented code, updated the table so that undefined and …
downiec May 24, 2023
50ddc18
Updated the link to correctly use solr URL
downiec May 25, 2023
af154d9
Removed unneccessary print statements in backend, removed commented c…
downiec May 26, 2023
4483eb8
Added some new message content for the new v1.0.9 Globus update. Stil…
downiec May 26, 2023
7b5f687
Added config option for setting globus enabled nodes which specifies …
downiec May 27, 2023
79f742b
Initial v1.0.9 branch update. Includes updating the version number in…
downiec Jun 10, 2023
e0eef98
Correct the Search URL setting (#525)
sashakames Jun 21, 2023
e0682d6
Added feature to filter search results by globus download availabilit…
downiec Jun 21, 2023
6817230
Updated UI so that Globus Download indicators don't show unless globu…
downiec Jun 21, 2023
9d338fb
Added logic that will determine whether there are selected items that…
downiec Jun 22, 2023
48375ab
Updated the globus ready download with some refactoring to improve se…
downiec Jun 22, 2023
3ea023d
Merged in the latest v1.0.9 branch
downiec Jun 22, 2023
bd03119
Removed obsolete/unused code to help reduce coverage requirements and…
downiec Jun 23, 2023
4b7051f
Changed the language of some messages and text to refer to functional…
downiec Jun 23, 2023
f996a1a
Created a task submitted list, which will allow user to view Globus T…
downiec Jun 24, 2023
e0617f2
Found and fixed the issue with message update closing too quickly. Fi…
downiec Jun 28, 2023
56ac6c6
Updated the joyride tutorial to include the globus ready icon and the…
downiec Jun 28, 2023
c119872
Added logic to ensure transfers aren't done too quickly (which may ca…
downiec Jun 29, 2023
9c7f3b9
Resolved issue with blank message popup when clicking remove all item…
downiec Jun 29, 2023
0bf9307
Messages to accompany Globus Transfer beta release (#534)
sashakames Jun 29, 2023
bd9d00e
Created notification functions to simplify code a bit and to adjust l…
downiec Jun 30, 2023
d65fb2c
Fixed the issues encountered with the manage_metagrid.sh functions on…
downiec Jul 14, 2023
51f0fa7
wget-debug
sashakames Jul 21, 2023
2eae86b
Nodes link and Django, packages upgrade (#540)
sashakames Jul 22, 2023
db810a6
Removed unused functions from backend, cleaned up some styling in the…
downiec Jul 22, 2023
7d225b0
Updated keycloak-js to 19.0.3 and using login.esgf.io for localhost (…
sturoscy-personal Jul 25, 2023
c498715
resolve packages
sashakames Jul 25, 2023
85c898d
Upgraded to React 18.2, upgraded to antd 4.24, and upgraded node vers…
downiec Jul 28, 2023
687e037
In process of fixing several tests. Too many are broken and will need…
downiec Aug 5, 2023
64eb001
Refactored the whole test suite to use userEvent rather than fireEven…
downiec Aug 5, 2023
ac70acc
update projects and local settings for devel
sashakames Aug 10, 2023
1693fda
resolve and merge
sashakames Aug 10, 2023
ad89b0a
Merge branch 'updated_project_links' into wget-simple
sashakames Aug 10, 2023
81d7337
correct urls
sashakames Aug 14, 2023
139d39b
Got tests to pass: skipped failing tests, fixed a few tests and creat…
downiec Aug 16, 2023
d2f5e24
Skipped one more failing test
downiec Aug 16, 2023
58f5f27
cleanup conflict markers
sashakames Aug 21, 2023
a39b1b4
ome minor fixes to improve coverage
downiec Aug 22, 2023
3032e97
wget api post initial test.
downiec Aug 22, 2023
f803d80
Merge branch 'integration-keycloak' into fix_wget_script
sashakames Aug 22, 2023
5bbf0b0
update view
sashakames Aug 22, 2023
c15f7b4
Fixed issue where the 'downloading' icon continues to show even after…
downiec Aug 22, 2023
0f110af
fix post on backend do_request
sashakames Aug 22, 2023
ee68b57
Merge branch 'fix_wget_script' of https://github.com/aims-group/metag…
sashakames Aug 22, 2023
d224665
Added timestamp for the wget script filename.
downiec Aug 22, 2023
2c448b0
Merge branch 'fix_wget_script' into globus_dev_demo_updates and ignor…
downiec Aug 23, 2023
d1dc1c2
Updated comment regarding the fetchWgetScript
downiec Aug 23, 2023
92c675b
fix issue using legacy wget API, need to unpack arrays them pass as data
sashakames Aug 23, 2023
cef39e6
Merge branch 'fix_wget_script' of https://github.com/aims-group/metag…
sashakames Aug 23, 2023
80f040f
resolve
sashakames Aug 23, 2023
01b86d5
Merged in the beta_integration branch
downiec Aug 24, 2023
d72bacb
Updated the version number and changelog.
downiec Aug 24, 2023
6cfe4c4
Integrated changes to keycloak from the integration_keycloak brannch
downiec Aug 24, 2023
f4abff8
Fixed some issue with the custom-render and the message displayed on …
downiec Aug 24, 2023
3df0aee
Minor patch to the updateProjects.sh script
downiec Aug 25, 2023
1152b59
Updated change log notes.
downiec Aug 25, 2023
9a9d751
change flow
sashakames Aug 28, 2023
145b97e
resolved
sashakames Aug 30, 2023
cb9cb79
Merge branch 'standard_flow' into wget-simple
sashakames Aug 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ env:
DATABASE_URL: pgsql://postgres:postgres@localhost:5432/postgres
REACT_APP_ESGF_NODE_URL: https://esgf-node.llnl.gov/esg-search/search
REACT_APP_WGET_API_URL: https://greyworm1-rh7.llnl.gov/wget
REACT_APP_ESGF_NODE_STATUS_URL: https://aims4.llnl.gov/prometheus/api/v1/query?query=probe_success%7Bjob%3D%22http_2xx%22%2C+target%3D~%22.%2Athredds.%2A%22%7D

REACT_APP_GLOBUS_SCRIPT_URL: https://greyworm1-rh7.llnl.gov/globusscript
REACT_APP_ESGF_NODE_STATUS_URL: https://aims2.llnl.gov/metagrid-backend/proxy/status
REACT_APP_ESGF_SOLR_URL: https://esgf-fedtest.llnl.gov/solr

jobs:
build:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:11.6
image: postgres:12.6
env:
POSTGRES_PASSWORD: postgres
ports:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.pytest_cache/

# Config backups
metagrid_configs/metagrid_config
metagrid_configs/backups

### Linux template
Expand Down
5 changes: 2 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"typescript",
"typescriptreact"
],
"eslint.workingDirectories": ["./frontend/"],
// Jest
// -----------------------------
"jest.pathToJest": "yarn test:watch",
Expand All @@ -76,7 +77,5 @@
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"python.analysis.extraPaths": [
"backend/venv/bin/python"
]
"python.analysis.extraPaths": ["backend/venv/bin/python"]
}
20 changes: 13 additions & 7 deletions backend/.envs/.django
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,26 @@ DOMAIN_NAME=http://localhost:8000
# ------------------------------------------------------------------------------
CORS_ORIGIN_WHITELIST=http://localhost:3000

# django-all-auth
# ------------------------------------------------------------------------------
KEYCLOAK_URL=http://keycloak:8080/auth
KEYCLOAK_REALM=metagrid
KEYCLOAK_CLIENT_ID=backend

REACT_APP_GLOBUS_SCRIPT_URL=https://greyworm1-rh7.llnl.gov/globusscript

KEYCLOAK_URL=https://login.esgf.io/
KEYCLOAK_REALM=esgf
KEYCLOAK_CLIENT_ID=metagrid-localhost

# ESGF wget API
# https://github.com/ESGF/esgf-wget
REACT_APP_WGET_API_URL=https://nimbus3.llnl.gov/wget
#REACT_APP_WGET_API_URL=https://greyworm1-rh7.llnl.gov/wget
REACT_APP_WGET_API_URL=https://esgf-node.llnl.gov/esg-search/wget


# ESGF Search API
# https://esgf.github.io/esg-search/ESGF_Search_RESTful_API.html
REACT_APP_ESGF_NODE_URL=https://esgf-node.llnl.gov/esg-search/search
REACT_APP_SEARCH_URL=https://esgf-node.llnl.gov/esg-search/search

# ESGF Node Status API
# https://github.com/ESGF/esgf-utils/blob/master/node_status/query_prom.py
REACT_APP_ESGF_NODE_STATUS_URL=https://aims2.llnl.gov/metagrid-backend/proxy/status

# ESGF Solr URL
REACT_APP_ESGF_SOLR_URL=https://esgf-fedtest.llnl.gov/solr
45 changes: 45 additions & 0 deletions backend/UpdateProjectData_README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
STEPS TO UPDATE PROJECTS, FACETS OR CATEGORIES

1. Edit the initial data file with the desired changes: metagrid/backend/metagrid/initial_projects_data.py
2. Change to the backend directory:
cd metagrid/backend/
3. Make sure the docker traefik and backend containers are up and running.
If not running, you can run the containers by going to the traefik directory first and running this command:
sudo docker compose -f docker-compose.prod.yml up --build -d
Then do the same in the backend directory (production backend depends on traefik)

RUN UPDATE AND CLEAR TABLES
If you need to clear tables to remove existing facets/projects or change their order then do the steps below:

Option 1:
4. Use the updateProjects.sh script. Just run the script using clear option:
sudo ./updateProject.sh --clear

DONE!

Option 2: Manually update without the script and clear tables:
4. sudo docker compose -f docker-compose.prod.yml build django # Build the container
5. sudo docker compose -f docker-compose.prod.yml run --rm django python manage.py migrate projects zero
6. sudo docker compose -f docker-compose.prod.yml run --rm django python manage.py migrate projects

DONE!

RUN UPDATE WITHOUT CLEARING TABLES
If your update is small and only involves minor modifications or additions to existing projects then you don't need to clear the tables.
If there are deletions or more significant changes, run steps above which include clearing tables otherwise do steps below:

Option 1:
4. Use the updateProjects.sh script. Just run the default script:
sudo ./updateProject.sh

DONE!

Option 2: Manually update without the script and don't clear tables:
4. sudo docker compose -f docker-compose.prod.yml build django # Build the container
5. sudo docker compose -f docker-compose.prod.yml run --rm django python manage.py migrate --fake projects 0001_initial
6. sudo docker compose -f docker-compose.prod.yml run --rm django python manage.py migrate projects

DONE!

MIGRATION FILE ISSUES:
If there are issues when attempting the steps above, make sure you don't have obsolete or modified migration files that don't match what's in the latest repository.
10 changes: 7 additions & 3 deletions backend/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
"django.middleware.clickjacking.XFrameOptionsMiddleware",
)

SESSION_SAVE_EVERY_REQUEST = True

# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1"]
ROOT_URLCONF = "config.urls"
Expand Down Expand Up @@ -272,7 +274,7 @@
"KEYCLOAK_REALM": env(
"KEYCLOAK_REALM",
),
}
},
}
# Used in data migration to register Keycloak social app
KEYCLOAK_CLIENT_ID = env("KEYCLOAK_CLIENT_ID")
Expand All @@ -295,9 +297,11 @@
# -------------------------------------------------------------------------------
# https://github.com/adamchainz/django-cors-headers#setup
CORS_ORIGIN_ALLOW_ALL = False
CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_WHITELIST = env.list("CORS_ORIGIN_WHITELIST")


SEARCH_URL = env("REACT_APP_ESGF_NODE_URL")
SEARCH_URL = env("REACT_APP_SEARCH_URL")
WGET_URL = env("REACT_APP_WGET_API_URL")
STATUS_URL = env("REACT_APP_ESGF_NODE_STATUS_URL")
SOLR_URL = env("REACT_APP_ESGF_SOLR_URL")
GLOBUS_SCRIPT_URL = env("REACT_APP_GLOBUS_SCRIPT_URL")
16 changes: 15 additions & 1 deletion backend/config/urls.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@
from rest_framework import permissions
from rest_framework.routers import DefaultRouter

from metagrid.api_proxy.views import do_citation, do_search, do_status, do_wget
from metagrid.api_globus.views import do_globus_transfer, get_access_token
from metagrid.api_proxy.views import (
do_citation,
do_globus_script,
do_search,
do_status,
do_wget,
get_temp_storage,
set_temp_storage,
)
from metagrid.cart.views import CartViewSet, SearchViewSet
from metagrid.projects.views import ProjectsViewSet
from metagrid.users.views import UserCreateViewSet, UserViewSet
Expand Down Expand Up @@ -50,9 +59,14 @@ class KeycloakLogin(SocialLoginView):
path("proxy/citation", do_citation, name="do-citation"),
path("proxy/wget", do_wget, name="do-wget"),
path("proxy/status", do_status, name="do-status"),
path("proxy/globus_script", do_globus_script, name="do-globusscript"),
path(
"dj-rest-auth/keycloak", KeycloakLogin.as_view(), name="keycloak_login"
),
path("tempStorage/get", get_temp_storage, name="temp_storage_get"),
path("tempStorage/set", set_temp_storage, name="temp_storage_set"),
path("globus/auth", get_access_token, name="globus_auth"),
path("globus/transfer", do_globus_transfer, name="globus_transfer"),
re_path(
r"^account-confirm-email/",
VerifyEmailView.as_view(),
Expand Down
17 changes: 0 additions & 17 deletions backend/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,6 @@ services:
ports:
- "5433:5432"

keycloak:
# Source: https://github.com/keycloak/keycloak-containers/blob/master/docker-compose-examples/keycloak-postgres.yml
image: jboss/keycloak
container_name: keycloak
# https://github.com/jhipster/generator-jhipster/issues/7157#issuecomment-367813386
depends_on:
- postgres
volumes:
- ./docker/local/keycloak:/opt/jboss/keycloak/imports
env_file:
- ./.envs/.keycloak
ports:
- "8080:8080"
command: -Dkeycloak.import=/opt/jboss/keycloak/imports/realm-export.json
-Dkeycloak.migration.strategy=IGNORE_EXISTING

django:
build:
context: .
Expand All @@ -46,7 +30,6 @@ services:
container_name: django
depends_on:
- postgres
- keycloak
volumes:
- .:/app
env_file:
Expand Down
2 changes: 1 addition & 1 deletion backend/docker/local/django/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN apt-get update \

# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN pip install -r /requirements/local.txt
RUN pip3 install -r /requirements/local.txt

COPY ./docker/production/django/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint
Expand Down
2 changes: 1 addition & 1 deletion backend/docker/production/django/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN addgroup --system django \

# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN pip install --no-cache-dir -r /requirements/production.txt \
RUN pip3 install --no-cache-dir -r /requirements/production.txt \
&& rm -rf /requirements

COPY ./docker/production/django/entrypoint /entrypoint
Expand Down
2 changes: 1 addition & 1 deletion backend/docker/production/postgres/maintenance/backup
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
### Create a database backup.
###
### Usage:
### $ docker-compose -f <environment>.yml (exec |run --rm) postgres backup
### $ docker compose -f <environment>.yml (exec |run --rm) postgres backup


set -o errexit
Expand Down
2 changes: 1 addition & 1 deletion backend/docker/production/postgres/maintenance/restore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
### <1> filename of an existing backup.
###
### Usage:
### $ docker-compose -f <environment>.yml (exec |run --rm) postgres restore <1>
### $ docker compose -f <environment>.yml (exec |run --rm) postgres restore <1>


set -o errexit
Expand Down
Empty file.
Empty file.
56 changes: 56 additions & 0 deletions backend/metagrid/api_globus/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase

from metagrid.api_globus.views import split_value, truncate_urls


class TestGlobusViewSet(APITestCase):
def test_truncate(self):
lst = [{"url": ["test_url:globus_value|Globus"]}]
results = []
for value in truncate_urls(lst):
results.append(value)
assert results == ["globus_value"]

def test_split_value(self):
result = split_value(1)
result2 = split_value(1.0)
result3 = split_value("noSplitting")
result4 = split_value("splitValues,values")
result5 = split_value("splitValues,values,CESM1(CAM5.1,FV2)")
result6 = split_value(
"{splitValues,test},[test,test2],CESM1(CAM5.1,FV2)"
)

assert result == 1
assert result2 == 1.0
assert result3 == ["noSplitting"]
assert result4 == ["splitValues", "values"]
assert result5 == ["splitValues", "values", "CESM1(CAM5.1,FV2)"]
assert result6 == [
"{splitValues,test}",
"[test,test2]",
"CESM1(CAM5.1,FV2)",
]

def test_get_access_token(self):
url = reverse("globus_auth")
getdata = {}
response = self.client.post(url, getdata)
assert response.status_code == status.HTTP_404_NOT_FOUND

def test_globus_transfer(self):
url = reverse("globus_transfer")
getdata = {}
response = self.client.get(url, getdata)
assert response.status_code == status.HTTP_400_BAD_REQUEST

postdata = {
"access_token": "",
"refresh_token": "",
"endpointId": "test",
"path": "bad/path",
}
response = self.client.post(url, postdata)
assert response.status_code == status.HTTP_400_BAD_REQUEST
Loading