From 73e79599cd73ba1bc6fcf9eec5b23ad6b2b2459e Mon Sep 17 00:00:00 2001 From: Doug Newman <douglas.j.newman@nasa.gov> Date: Mon, 29 Apr 2024 17:11:36 -0400 Subject: [PATCH] Remove token (#528) Co-authored-by: doug-newman-nasa <douglas.j.newamn@nasa.gov> --- poetry.lock | 11 -- .../TestResults.test_data_links.yaml | 105 +++++++++--------- tests/unit/test_results.py | 62 ++++++++++- 3 files changed, 115 insertions(+), 63 deletions(-) diff --git a/poetry.lock b/poetry.lock index f8c4eba9..eb125fc5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3850,7 +3850,6 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, - {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -3858,16 +3857,8 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, - {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, - {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, - {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, - {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, - {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, - {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -3884,7 +3875,6 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, - {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -3892,7 +3882,6 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, - {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, diff --git a/tests/unit/fixtures/vcr_cassettes/TestResults.test_data_links.yaml b/tests/unit/fixtures/vcr_cassettes/TestResults.test_data_links.yaml index 1b9e08ac..762064e1 100644 --- a/tests/unit/fixtures/vcr_cassettes/TestResults.test_data_links.yaml +++ b/tests/unit/fixtures/vcr_cassettes/TestResults.test_data_links.yaml @@ -10,7 +10,8 @@ interactions: uri: https://urs.earthdata.nasa.gov/api/users/tokens response: body: - string: '[{"access_token":"eyJ0eXAiOiJKV1QiLCJvcmlnaW4iOiJFYXJ0aGRhdGEgTG9naW4iLCJzaWciOiJlZGxqd3RwdWJrZXlfb3BzIiwiYWxnIjoiUlMyNTYifQ.eyJ0eXBlIjoiVXNlciIsInVpZCI6ImRzY2h1Y2siLCJleHAiOjE3MTcyNjM4MTMsImlhdCI6MTcxMjA3OTgxMywiaXNzIjoiRWFydGhkYXRhIExvZ2luIn0.S_tw0-5JNFEv3si07GYVxvQi81QejNAT2Sh2ZIxAwmqr9UqoSmYg2Wp2Jdn3jaWrSVsRgxBXuLD5w7XFeRju2qOtIqovN3XGJ8VnTdvpklr-gTjk_iLq58334Zzbu5ntnqy-QTzPCKvjvqr3GNuIJcp9z7j5rzd3MEUYOFP1xsd8wehGLpBHzT6ZSzCOwdgzE1AufKq9Vd2GqM_5bc3M9cj-gGy2g3m1mP2OB41wiGvPzup79ds4t_gEPkCecm2rplCP4n1hrY6ZQtXshgM6o49J1nkGSJjE0olHcPwEujKE2s1htWZEycI1TCCxrGpx8K1vwEd0lNaekgPUWwdOlA","token_type":"Bearer","expiration_date":"06/01/2024"}]' + string: '[{"access_token": "REDACTED", "token_type": "Bearer", "expiration_date": + "05/13/2024"}]' headers: Cache-Control: - no-store @@ -19,9 +20,9 @@ interactions: Content-Type: - application/json; charset=utf-8 Date: - - Tue, 09 Apr 2024 21:58:55 GMT + - Fri, 26 Apr 2024 19:01:02 GMT ETag: - - W/"61d0ce8df0bc684ac04ce623aea3668c" + - W/"a29dde6ffea7ea829fb5709ec38b2b11" Expires: - Fri, 01 Jan 1990 00:00:00 GMT Pragma: @@ -45,9 +46,9 @@ interactions: X-Permitted-Cross-Domain-Policies: - none X-Request-Id: - - 28f6c88b-114d-4319-b6a2-0de0f54c9405 + - f41262c4-1360-4246-8c5b-5b54b46717fb X-Runtime: - - '0.013338' + - '0.017973' X-XSS-Protection: - 1; mode=block status: @@ -61,11 +62,15 @@ interactions: Connection: - keep-alive method: GET - uri: https://urs.earthdata.nasa.gov/api/users/dschuck?client_id=ntD0YGC_SM3Bjs-Tnxd7bg + uri: https://urs.earthdata.nasa.gov/api/users/REDACTED?client_id=REDACTED response: body: - string: '{"uid":"dschuck","first_name":"Charles","last_name":"Daniels","email_address":"chuck@developmentseed.org","registered_date":" - 2 Apr 2024 17:43:33PM","country":"United States","study_area":"Other","allow_auth_app_emails":true,"user_type":"Application","affiliation":"Commercial","agreed_to_meris_eula":true,"agreed_to_sentinel_eula":true,"email_verified":true,"user_groups":[],"user_authorized_apps":23,"nams_auid":null}' + string: '{"uid": "REDACTED", "first_name": "REDACTED", "last_name": "REDACTED", + "email_address": "REDACTED", "registered_date": " 6 Jan 2023 13:19:54PM", + "country": "United States", "study_area": "Atmospheric Aerosols", "allow_auth_app_emails": + true, "user_type": "Public User", "affiliation": "GOVERNMENT", "organization": + "ECHO", "agreed_to_meris_eula": false, "agreed_to_sentinel_eula": false, "email_verified": + true, "user_groups": [], "user_authorized_apps": 50, "nams_auid": "REDACTED"}' headers: Cache-Control: - no-store @@ -74,9 +79,9 @@ interactions: Content-Type: - application/json; charset=utf-8 Date: - - Tue, 09 Apr 2024 21:58:55 GMT + - Fri, 26 Apr 2024 19:01:05 GMT ETag: - - W/"5d6f0c723c97c730432ca73084995037" + - W/"df58383a0996c7343807319c935bc446" Expires: - Fri, 01 Jan 1990 00:00:00 GMT Pragma: @@ -100,9 +105,9 @@ interactions: X-Permitted-Cross-Domain-Policies: - none X-Request-Id: - - c8cf2bd3-731d-4863-8967-1906de679cbc + - 3cc78a6c-670f-4d43-a837-c8c324a5a367 X-Runtime: - - '0.017383' + - '0.432446' X-XSS-Protection: - 1; mode=block status: @@ -128,7 +133,7 @@ interactions: Content-Type: - text/html; charset=utf-8 Date: - - Tue, 09 Apr 2024 21:58:55 GMT + - Fri, 26 Apr 2024 19:01:05 GMT Location: - https://urs.earthdata.nasa.gov/home Referrer-Policy: @@ -136,8 +141,8 @@ interactions: Server: - nginx/1.22.1 Set-Cookie: - - _urs-gui_session=abd23c587ce267b8c84ef154346028b0; path=/; expires=Wed, 10 - Apr 2024 21:58:55 GMT; HttpOnly + - _urs-gui_session=dd31f5f10e3bb3b9d9a07b3d52dad224; path=/; expires=Sat, 27 + Apr 2024 19:01:05 GMT; HttpOnly Strict-Transport-Security: - max-age=31536000 Transfer-Encoding: @@ -151,9 +156,9 @@ interactions: X-Permitted-Cross-Domain-Policies: - none X-Request-Id: - - b6384698-e18b-4a99-b80c-b0ebe6cb80b7 + - 67297224-26a6-4674-9b8e-138f6327eb85 X-Runtime: - - '0.008282' + - '0.009517' X-XSS-Protection: - 1; mode=block status: @@ -166,8 +171,6 @@ interactions: - '*/*' Connection: - keep-alive - Cookie: - - _urs-gui_session=abd23c587ce267b8c84ef154346028b0 method: GET uri: https://urs.earthdata.nasa.gov/home response: @@ -185,12 +188,12 @@ interactions: \ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n \ })(window,document,'script','dataLayer','GTM-WNP7MLF');</script>\n <!-- End Google Tag Manager -->\n\n <link href=\"https://cdn.earthdata.nasa.gov/eui/1.1.3/stylesheets/application.css\" - rel=\"stylesheet\" />\n <link rel=\"stylesheet\" href=\"/assets/application-d9676c03949446ce1c936d36d78a58525aac3f85bd2ff83160510fb600cda744.css\" + rel=\"stylesheet\" />\n <link rel=\"stylesheet\" href=\"/assets/application-2a77b6483df06458b29e8033e0c8bc9fd8ae66918c52556d8527414dea566bc0.css\" media=\"all\" />\n <!--[if IE 7]>\n <link rel=\"stylesheet\" href=\"/assets/font-awesome-ie7.min.css\">\n \ <![endif]-->\n <link href=\"//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n <link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,700' rel='stylesheet' type='text/css'>\n <meta name=\"csrf-param\" content=\"authenticity_token\" - />\n<meta name=\"csrf-token\" content=\"HnqBUL1BEA6amXF5OW_TCivwa3egRrKDIv8HhcBZbSO-S8x6GruAEm0UCIjTRfr2hXUF8NNhrcLBToSYCrb6Mw\" + />\n<meta name=\"csrf-token\" content=\"Hvd-LhrtPcOJiyYVIa0T7igzxhHrhZXpuYJaBlQxt9cCrpPlCkqWiUX-wXFhZkBsC58dFSSB4_8mKj5CcqToJA\" />\n \n\n <!-- Grid background: http://subtlepatterns.com/graphy/ -->\n \ </head>\n <body class=\"static_pages home\" data-turbolinks-eval=false>\n\n \ <!-- Google Tag Manager (noscript) -->\n <noscript>\n <iframe @@ -212,7 +215,7 @@ interactions: \ <section id=\"callout-login\">\n <form id=\"login\" action=\"/login\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" autocomplete=\"off\" /><input type=\"hidden\" name=\"authenticity_token\" - value=\"dgkQWfC57cs1blV-hxuIctuaBd8_DtQ47pqFd5NE4_nWOF1zV0N918LjLI9tMaGOdR9rWEwpy3kNKwZqWat06Q\" + value=\"S9eHuIpZwPYfQGKZNGgcSwfqGfEsNapmPGO6FYo5_ONXjmpzmv5rvNM1hf10o0_JJEbC9eMx3HCjy95RrKyjEA\" autocomplete=\"off\" />\n <p>\n <label for=\"username\">Username</label>\n \ <i class=\"fa fa-question-circle fa-question-circle--blue user-name\" title=\"Login using either your Username or Email Address\"></i>\n <input @@ -259,7 +262,7 @@ interactions: \ <h3>For questions regarding the EOSDIS Earthdata Login, please contact <a href=\"javascript:feedback.showForm();\" title=\"Earthdata Support form\">Earthdata Support</a></h3>\n <ul>\n <li class=\"version badge eui-badge--md\">V - 4.199.0\n</li>\n <li><a href=\"/\">Home</a></li>\n <li><a href=\"/users/new\">Register</a></li>\n + 4.200.0\n</li>\n <li><a href=\"/\">Home</a></li>\n <li><a href=\"/users/new\">Register</a></li>\n \ <li><a title=\"NASA Home\" href=\"http://www.nasa.gov\">NASA</a></li>\n \ <li><a title=\"Accessability\" href=\"https://www.nasa.gov/accessibility/\">Accessibility</a></li>\n \ </ul>\n <p>NASA Official: Stephen Berrick</p>\n</footer>\n\n <script @@ -287,9 +290,9 @@ interactions: Content-Type: - text/html; charset=utf-8 Date: - - Tue, 09 Apr 2024 21:58:55 GMT + - Fri, 26 Apr 2024 19:01:05 GMT ETag: - - W/"7af405988c901d45ff1b80e3d54e85fa" + - W/"4bf1251d0bbafea1eb0c10cd9456806b" Expires: - Fri, 01 Jan 1990 00:00:00 GMT Pragma: @@ -299,8 +302,8 @@ interactions: Server: - nginx/1.22.1 Set-Cookie: - - _urs-gui_session=abd23c587ce267b8c84ef154346028b0; path=/; expires=Wed, 10 - Apr 2024 21:58:55 GMT; HttpOnly + - _urs-gui_session=dd31f5f10e3bb3b9d9a07b3d52dad224; path=/; expires=Sat, 27 + Apr 2024 19:01:05 GMT; HttpOnly Strict-Transport-Security: - max-age=31536000 Transfer-Encoding: @@ -316,9 +319,9 @@ interactions: X-Permitted-Cross-Domain-Policies: - none X-Request-Id: - - a5f4494f-83d0-40cc-a966-a45d47155163 + - 77524554-086c-4cab-9ccc-5098db521baf X-Runtime: - - '0.012801' + - '0.009368' X-XSS-Protection: - 1; mode=block content-length: @@ -334,10 +337,10 @@ interactions: Connection: - keep-alive method: GET - uri: https://cmr.earthdata.nasa.gov/search/granules.umm_json?short_name=SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205&temporal%5B%5D=2020-01-01T00:00:00Z,2022-01-01T00:00:00Z&page_size=0 + uri: https://cmr.earthdata.nasa.gov/search/granules.umm_json?page_size=0&short_name=SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205&temporal%5B%5D=2020-01-01T00%3A00%3A00Z%2C2022-01-01T00%3A00%3A00Z response: body: - string: '{"hits":147,"took":55,"items":[]}' + string: '{"hits":147,"took":53,"items":[]}' headers: Access-Control-Allow-Origin: - '*' @@ -347,19 +350,19 @@ interactions: CMR-Hits: - '147' CMR-Request-Id: - - c8f9b01d-a6a3-4809-8a65-e707f30b3d47 + - 2cbf1e55-a28f-4df8-8dde-398658ac80e1 CMR-Took: - - '55' + - '54' Connection: - keep-alive Content-MD5: - - 376935be7b2a0e96352603908fe0dcd5 + - fc56016e390f9d3d2c1d94d2a9160402 Content-SHA1: - - b02f8a240f36ad8cd6798334ce2455c338e6d55f + - 9a23cddba6e9325547fffd5faa676a455369786a Content-Type: - application/vnd.nasa.cmr.umm_results+json;version=1.6.5; charset=utf-8 Date: - - Tue, 09 Apr 2024 21:58:56 GMT + - Fri, 26 Apr 2024 19:01:07 GMT Server: - ServerTokens ProductOnly Strict-Transport-Security: @@ -369,11 +372,11 @@ interactions: Vary: - Accept-Encoding, User-Agent Via: - - 1.1 f300b5f0c0ff51593fb31953294424c0.cloudfront.net (CloudFront) + - 1.1 a929b4bfaa0111e3feb7c4dbffdbd8d8.cloudfront.net (CloudFront) X-Amz-Cf-Id: - - 6UKqbnR1dCiMWGTDKFtLjE_KomjiZXUhp0ICfljulkAzPCeqJgb3cw== + - salFIE2yXSjG9Sx6EaR68NQZLZIDrgw_3NaG6CSnC74FWRGMIK7a_A== X-Amz-Cf-Pop: - - PHL51-P1 + - IAD79-C1 X-Cache: - Miss from cloudfront X-Content-Type-Options: @@ -381,7 +384,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Request-Id: - - 6UKqbnR1dCiMWGTDKFtLjE_KomjiZXUhp0ICfljulkAzPCeqJgb3cw== + - salFIE2yXSjG9Sx6EaR68NQZLZIDrgw_3NaG6CSnC74FWRGMIK7a_A== X-XSS-Protection: - 1; mode=block content-length: @@ -397,10 +400,10 @@ interactions: Connection: - keep-alive method: GET - uri: https://cmr.earthdata.nasa.gov/search/granules.umm_json?short_name=SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205&temporal%5B%5D=2020-01-01T00:00:00Z,2022-01-01T00:00:00Z&page_size=1 + uri: https://cmr.earthdata.nasa.gov/search/granules.umm_json?page_size=1&short_name=SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205&temporal%5B%5D=2020-01-01T00%3A00%3A00Z%2C2022-01-01T00%3A00%3A00Z response: body: - string: '{"hits":147,"took":253,"items":[{"meta":{"concept-type":"granule","concept-id":"G2546526969-POCLOUD","revision-id":2,"native-id":"ssh_grids_v2205_2020010212","collection-concept-id":"C2270392799-POCLOUD","provider-id":"POCLOUD","format":"application/vnd.nasa.cmr.umm+json","revision-date":"2023-01-11T00:16:28.862Z"},"umm":{"TemporalExtent":{"RangeDateTime":{"EndingDateTime":"2020-01-02T00:00:00.000Z","BeginningDateTime":"2020-01-02T00:00:00.000Z"}},"MetadataSpecification":{"URL":"https://cdn.earthdata.nasa.gov/umm/granule/v1.6.5","Name":"UMM-G","Version":"1.6.5"},"GranuleUR":"ssh_grids_v2205_2020010212","ProviderDates":[{"Type":"Insert","Date":"2023-01-11T00:16:13.878Z"},{"Type":"Update","Date":"2023-01-11T00:16:13.878Z"}],"SpatialExtent":{"HorizontalSpatialDomain":{"Geometry":{"BoundingRectangles":[{"WestBoundingCoordinate":0.083,"SouthBoundingCoordinate":-79.917,"EastBoundingCoordinate":180,"NorthBoundingCoordinate":79.917},{"WestBoundingCoordinate":-180,"SouthBoundingCoordinate":-79.917,"EastBoundingCoordinate":-0.083,"NorthBoundingCoordinate":79.917}]}}},"DataGranule":{"ArchiveAndDistributionInformation":[{"SizeUnit":"MB","Size":9.246453285217285,"Checksum":{"Value":"9002febf17632e5921eba5b8f62237e6","Algorithm":"MD5"},"SizeInBytes":9695609,"Name":"ssh_grids_v2205_2020010212.nc"},{"SizeUnit":"MB","Size":6.008148193359375E-5,"Checksum":{"Value":"b0c271019f89f876b2d3c0a9c46b8f77","Algorithm":"MD5"},"SizeInBytes":63,"Name":"ssh_grids_v2205_2020010212.nc.md5"}],"DayNightFlag":"Unspecified","ProductionDateTime":"2022-10-30T20:57:22.377Z"},"CollectionReference":{"Version":"2205","ShortName":"SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205"},"RelatedUrls":[{"URL":"https://archive.podaac.earthdata.nasa.gov/podaac-ops-cumulus-public/SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205/ssh_grids_v2205_2020010212.nc.md5","Description":"Download + string: '{"hits":147,"took":250,"items":[{"meta":{"concept-type":"granule","concept-id":"G2546526969-POCLOUD","revision-id":2,"native-id":"ssh_grids_v2205_2020010212","collection-concept-id":"C2270392799-POCLOUD","provider-id":"POCLOUD","format":"application/vnd.nasa.cmr.umm+json","revision-date":"2023-01-11T00:16:28.862Z"},"umm":{"TemporalExtent":{"RangeDateTime":{"EndingDateTime":"2020-01-02T00:00:00.000Z","BeginningDateTime":"2020-01-02T00:00:00.000Z"}},"MetadataSpecification":{"URL":"https://cdn.earthdata.nasa.gov/umm/granule/v1.6.5","Name":"UMM-G","Version":"1.6.5"},"GranuleUR":"ssh_grids_v2205_2020010212","ProviderDates":[{"Type":"Insert","Date":"2023-01-11T00:16:13.878Z"},{"Type":"Update","Date":"2023-01-11T00:16:13.878Z"}],"SpatialExtent":{"HorizontalSpatialDomain":{"Geometry":{"BoundingRectangles":[{"WestBoundingCoordinate":0.083,"SouthBoundingCoordinate":-79.917,"EastBoundingCoordinate":180,"NorthBoundingCoordinate":79.917},{"WestBoundingCoordinate":-180,"SouthBoundingCoordinate":-79.917,"EastBoundingCoordinate":-0.083,"NorthBoundingCoordinate":79.917}]}}},"DataGranule":{"ArchiveAndDistributionInformation":[{"SizeUnit":"MB","Size":9.246453285217285,"Checksum":{"Value":"9002febf17632e5921eba5b8f62237e6","Algorithm":"MD5"},"SizeInBytes":9695609,"Name":"ssh_grids_v2205_2020010212.nc"},{"SizeUnit":"MB","Size":6.008148193359375E-5,"Checksum":{"Value":"b0c271019f89f876b2d3c0a9c46b8f77","Algorithm":"MD5"},"SizeInBytes":63,"Name":"ssh_grids_v2205_2020010212.nc.md5"}],"DayNightFlag":"Unspecified","ProductionDateTime":"2022-10-30T20:57:22.377Z"},"CollectionReference":{"Version":"2205","ShortName":"SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205"},"RelatedUrls":[{"URL":"https://archive.podaac.earthdata.nasa.gov/podaac-ops-cumulus-public/SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205/ssh_grids_v2205_2020010212.nc.md5","Description":"Download ssh_grids_v2205_2020010212.nc.md5","Type":"EXTENDED METADATA"},{"URL":"s3://podaac-ops-cumulus-public/SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205/ssh_grids_v2205_2020010212.nc.md5","Description":"This link provides direct download access via S3 to the granule","Type":"EXTENDED METADATA"},{"URL":"https://archive.podaac.earthdata.nasa.gov/podaac-ops-cumulus-protected/SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205/ssh_grids_v2205_2020010212.nc","Description":"Download @@ -419,21 +422,21 @@ interactions: CMR-Hits: - '147' CMR-Request-Id: - - 59762a2f-23b9-45a2-a99b-be84748be0e5 + - a1e2fe1c-2e10-4f2c-8db8-a5dbcbbd1fa8 CMR-Search-After: - '["pocloud",1577923200000,2546526969]' CMR-Took: - - '254' + - '252' Connection: - keep-alive Content-MD5: - - 53cf1a1f972e393a32e3cd15ec36f700 + - 9988c87ebf8c6903ad296f026b9e4e19 Content-SHA1: - - 60c47f03299dda570448eaecfbd8b3ed10f7bd5a + - a61b921f69eea84504a04df9da71b1cc33054817 Content-Type: - application/vnd.nasa.cmr.umm_results+json;version=1.6.5; charset=utf-8 Date: - - Tue, 09 Apr 2024 21:58:56 GMT + - Fri, 26 Apr 2024 19:01:07 GMT Server: - ServerTokens ProductOnly Strict-Transport-Security: @@ -443,11 +446,11 @@ interactions: Vary: - Accept-Encoding, User-Agent Via: - - 1.1 f300b5f0c0ff51593fb31953294424c0.cloudfront.net (CloudFront) + - 1.1 a929b4bfaa0111e3feb7c4dbffdbd8d8.cloudfront.net (CloudFront) X-Amz-Cf-Id: - - N9NqPFJ1jWMYiNKZDyuZ71_auV8xRiEL-06uHzn3q2PrTU66FCOKFA== + - AcJ2KDjMhAQjtEkQkpZDUP4U110W3XbXaqdPssU76tq3KWtzAw8WOg== X-Amz-Cf-Pop: - - PHL51-P1 + - IAD79-C1 X-Cache: - Miss from cloudfront X-Content-Type-Options: @@ -455,7 +458,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Request-Id: - - N9NqPFJ1jWMYiNKZDyuZ71_auV8xRiEL-06uHzn3q2PrTU66FCOKFA== + - AcJ2KDjMhAQjtEkQkpZDUP4U110W3XbXaqdPssU76tq3KWtzAw8WOg== X-XSS-Protection: - 1; mode=block content-length: diff --git a/tests/unit/test_results.py b/tests/unit/test_results.py index cc2f8d3a..c669e8d7 100644 --- a/tests/unit/test_results.py +++ b/tests/unit/test_results.py @@ -1,4 +1,7 @@ +import contextlib +import json import logging +import os.path import earthaccess from earthaccess.search import DataCollections @@ -7,6 +10,8 @@ logging.basicConfig() logging.getLogger("vcr").setLevel(logging.ERROR) +REDACTED_STRING = "REDACTED" + def unique_results(results): """ @@ -18,6 +23,38 @@ def unique_results(results): return len(unique_concept_ids) == len(results) +def redact_login_request(request): + if "/api/users/" in request.path and "/api/users/tokens" not in request.path: + _, user_name = os.path.split(request.path) + request.uri = request.uri.replace(user_name, REDACTED_STRING) + + return request + + +def redact_key_values(keys_to_redact): + def redact(payload): + for key in keys_to_redact: + if key in payload: + payload[key] = REDACTED_STRING + return payload + + def before_record_response(response): + body = response["body"]["string"].decode("utf8") + + with contextlib.suppress(json.JSONDecodeError): + payload = json.loads(body) + redacted_payload = ( + list(map(redact, payload)) + if isinstance(payload, list) + else redact(payload) + ) + response["body"]["string"] = json.dumps(redacted_payload).encode() + + return response + + return before_record_response + + class TestResults(VCRTestCase): def _get_vcr(self, **kwargs): myvcr = super(TestResults, self)._get_vcr(**kwargs) @@ -41,6 +78,22 @@ def _get_vcr(self, **kwargs): "Set-Cookie", "User-Agent", ] + myvcr.filter_query_parameters = [ + ("client_id", REDACTED_STRING), + ] + + myvcr.before_record_response = redact_key_values( + [ + "access_token", + "uid", + "first_name", + "last_name", + "email_address", + "nams_auid", + ] + ) + + myvcr.before_record_request = redact_login_request return myvcr @@ -50,6 +103,7 @@ def test_data_links(self): temporal=("2020", "2022"), count=1, ) + g = granules[0] # `access` specified assert g.data_links(access="direct")[0].startswith("s3://") @@ -118,7 +172,13 @@ def test_get_all_more_than_2k(self): # Assert that we performed a hits query and two search results queries self.assertEqual(len(self.cassette), 3) - self.assertEqual(len(granules), 2520) + self.assertEqual( + len(granules), int(self.cassette.responses[0]["headers"]["CMR-Hits"][0]) + ) + self.assertEqual( + len(granules), + min(3000, int(self.cassette.responses[0]["headers"]["CMR-Hits"][0])), + ) self.assertTrue(unique_results(granules)) def test_collections_less_than_2k(self):