From 425a8bb166c7004beafcfccc9e0412d0ec214986 Mon Sep 17 00:00:00 2001 From: Ashwini Sukale Date: Wed, 22 Nov 2023 14:00:30 +0530 Subject: [PATCH] Stubbed env needed for build (#138) * Fixed lint errors * Revert "Fixed lint errors" This reverts commit e7d3c67fc4d8078cc74d328a167b929ff5a1be92. * Added some more env variable value * Fixed test case --- .../push_item_with_valid_with_error.yml | 168 ++++++++++++++++++ spec/models/orcid_affiliation_spec.rb | 2 +- 2 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/vcr_cassettes/OrcidAffiliation/import_orcid_affiliations/_push_item/push_item_with_valid_with_error.yml diff --git a/spec/fixtures/vcr_cassettes/OrcidAffiliation/import_orcid_affiliations/_push_item/push_item_with_valid_with_error.yml b/spec/fixtures/vcr_cassettes/OrcidAffiliation/import_orcid_affiliations/_push_item/push_item_with_valid_with_error.yml new file mode 100644 index 00000000..c80bee2f --- /dev/null +++ b/spec/fixtures/vcr_cassettes/OrcidAffiliation/import_orcid_affiliations/_push_item/push_item_with_valid_with_error.yml @@ -0,0 +1,168 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.stage.datacite.org/users/0000-0001-2345-6789 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (compatible; Maremma/4.9.8; mailto:info@datacite.org) + Accept: + - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5 + Accept-Encoding: + - gzip,deflate + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Wed, 22 Nov 2023 07:44:12 GMT + Content-Type: + - application/json; charset=utf-8 + Connection: + - keep-alive + Status: + - 404 Not Found + Cache-Control: + - no-cache + Vary: + - Accept-Encoding, Origin + Content-Encoding: + - gzip + Referrer-Policy: + - strict-origin-when-cross-origin + X-Permitted-Cross-Domain-Policies: + - none + X-Xss-Protection: + - 1; mode=block + X-Request-Id: + - 23949186-499e-44d2-ac26-3afeb3f2807c + X-Download-Options: + - noopen + X-Runtime: + - '0.014296' + X-Frame-Options: + - SAMEORIGIN + X-Content-Type-Options: + - nosniff + X-Powered-By: + - Phusion Passenger(R) 6.0.18 + Server: + - nginx/1.18.0 + Phusion Passenger(R) 6.0.18 + body: + encoding: ASCII-8BIT + string: !binary |- + H4sIAEyxXWUAAwzHMQqAMAwF0KuELC4iDp08h5s4FP1qsTSQpKCId9ftvYehKmo8TA+bR68/OfSBW/bkGf/GA6QwqbqAbqkUFZRFzlR22kRpFVhpnHAl847f+f0AAAD//wMArpOW4VcAAAA= + http_version: null + recorded_at: Wed, 22 Nov 2023 07:42:47 GMT +- request: + method: get + uri: https://pub.orcid.org/v2.1/0000-0001-2345-6789/person + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (compatible; Maremma/4.9.8; mailto:info@datacite.org) + Accept: + - application/vnd.orcid+json + Accept-Encoding: + - gzip,deflate + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Wed, 22 Nov 2023 07:44:14 GMT + Content-Type: + - application/vnd.orcid+json;charset=UTF-8 + Content-Length: + - '307' + Connection: + - keep-alive + Cf-Ray: + - 829f8bc23a39320b-BOM + Cf-Cache-Status: + - DYNAMIC + Access-Control-Allow-Origin: + - "*" + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Expires: + - '0' + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Target: + - reg-prod-papi-dfw-x1 + X-Via: + - x2 + X-Xss-Protection: + - 1; mode=block + Vary: + - Accept-Encoding + Server: + - cloudflare + body: + encoding: ASCII-8BIT + string: |- + { + "response-code" : 404, + "developer-message" : "404 Not Found: The resource was not found. Full validation error: ORCID iD 0000-0001-2345-6789 not found", + "user-message" : "The resource was not found.", + "error-code" : 9016, + "more-info" : "https://members.orcid.org/api/resources/troubleshooting" + } + http_version: null + recorded_at: Wed, 22 Nov 2023 07:42:48 GMT +- request: + method: get + uri: https://api.ror.org/organizations/ror.org/normalized-ror-id + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (compatible; Maremma/4.9.8; mailto:info@datacite.org) + Accept: + - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5 + Accept-Encoding: + - gzip,deflate + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Wed, 22 Nov 2023 07:44:14 GMT + Content-Type: + - application/json + Content-Length: + - '64' + Connection: + - keep-alive + Status: + - 404 Not Found + Vary: + - Cookie, Origin + X-Frame-Options: + - SAMEORIGIN + Allow: + - GET, HEAD, OPTIONS + X-Powered-By: + - Phusion Passenger 6.0.7 + Server: + - nginx/1.18.0 + Phusion Passenger 6.0.7 + body: + encoding: ASCII-8BIT + string: '{"errors":["''ror.org/normalized-ror-id'' is not a valid ROR ID"]}' + http_version: null + recorded_at: Wed, 22 Nov 2023 07:42:49 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/models/orcid_affiliation_spec.rb b/spec/models/orcid_affiliation_spec.rb index 7fabc006..3f904e0f 100644 --- a/spec/models/orcid_affiliation_spec.rb +++ b/spec/models/orcid_affiliation_spec.rb @@ -99,7 +99,7 @@ allow(ENV).to receive(:[]).with("CROSSREF_QUERY_URL").and_return("https://fake.crossrefurl.com") allow(ENV).to receive(:[]).with("VOLPINO_URL").and_return("https://fake.volpinoapi.com") allow(ENV).to receive(:[]).with("SLACK_WEBHOOK_URL").and_return("") - allow(ENV).to receive(:[]).with("TRUSTED_IP").and_return("123444") + allow(ENV).to receive(:[]).with("http_proxy").and_return(nil) allow(Rails.logger).to receive(:info) end