From 29eeb8dfde4752e3b812bd9c821c21093aaab060 Mon Sep 17 00:00:00 2001 From: Patrick Tolosa Date: Mon, 15 Jun 2020 17:47:24 +0300 Subject: [PATCH] Allow external PRs to pass Travis tests - Exclude account API tests when tests are running in Travis from a Fork - Fix string assignment to process.env variable (would incorrectly get the value of "undefined" (as a string) --- test/cloudinary_spec.js | 4 ++-- test/integration/api/provisioning/account_spec.js | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/cloudinary_spec.js b/test/cloudinary_spec.js index 410ca56d..8e7dd8be 100644 --- a/test/cloudinary_spec.js +++ b/test/cloudinary_spec.js @@ -816,7 +816,7 @@ describe("cloudinary", function () { }); describe("CLOUDINARY_URL", function () { after(function () { - process.env.CLOUDINARY_URL = cloudinaryUrlBackup; + process.env.CLOUDINARY_URL = cloudinaryUrlBackup || ''; cloudinary.config(true); }); it("should allow nested values in CLOUDINARY_URL", function () { @@ -849,7 +849,7 @@ describe("cloudinary", function () { }); describe("CLOUDINARY_ACCOUNT_URL", function () { after(function () { - process.env.CLOUDINARY_ACCOUNT_URL = accountUrlBackup; + process.env.CLOUDINARY_ACCOUNT_URL = accountUrlBackup || ''; cloudinary.config(true); }); it("should allow nested values in CLOUDINARY_ACCOUNT_URL", function () { diff --git a/test/integration/api/provisioning/account_spec.js b/test/integration/api/provisioning/account_spec.js index fbd44533..34f4d714 100644 --- a/test/integration/api/provisioning/account_spec.js +++ b/test/integration/api/provisioning/account_spec.js @@ -6,7 +6,10 @@ const expect = require("expect.js"); const cloudinary = require("../../../../cloudinary"); const TIMEOUT = require('../../../testUtils/testConstants').TIMEOUT; -describe('account API - Provisioning', function () { +let runOnlyForInternalPRs = process.env.TRAVIS_SECURE_ENV_VARS ? describe : describe.skip; + + +runOnlyForInternalPRs('account API - Provisioning', function () { let CLOUD_SECRET; let CLOUD_API; let CLOUD_NAME;