From 9e1c7020566a573a3d6f0c1b6e549c1d90a1724b Mon Sep 17 00:00:00 2001 From: pocketpapa Date: Thu, 24 Oct 2019 14:55:07 -0400 Subject: [PATCH] feat(securitycache): refresh single provider --- src/resources/SecurityCache/SecurityCache.ts | 6 +++++- src/resources/SecurityCache/tests/SecurityCache.spec.ts | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/resources/SecurityCache/SecurityCache.ts b/src/resources/SecurityCache/SecurityCache.ts index 8ba8fe333..6f2fa9d76 100644 --- a/src/resources/SecurityCache/SecurityCache.ts +++ b/src/resources/SecurityCache/SecurityCache.ts @@ -11,7 +11,7 @@ import { } from './SecurityCacheInterfaces'; export default class SecurityCache extends Ressource { - static baseUrl = `/rest/organizations/${API.orgPlaceholder}`; + static baseUrl = `rest/organizations/${API.orgPlaceholder}`; static cacheUrl = `/${SecurityCache.baseUrl}/securitycache`; static providersUrl = `/${SecurityCache.baseUrl}/securityproviders`; @@ -39,6 +39,10 @@ export default class SecurityCache extends Ressource { return this.api.post(`${SecurityCache.cacheUrl}/refresh`); } + refreshProvider(providerId: string) { + return this.api.post(`${SecurityCache.cacheUrl}/${providerId}/refresh`); + } + listProviders() { return this.api.get(SecurityCache.providersUrl); } diff --git a/src/resources/SecurityCache/tests/SecurityCache.spec.ts b/src/resources/SecurityCache/tests/SecurityCache.spec.ts index 6dc0c8f99..4b1c448a0 100644 --- a/src/resources/SecurityCache/tests/SecurityCache.spec.ts +++ b/src/resources/SecurityCache/tests/SecurityCache.spec.ts @@ -56,6 +56,12 @@ describe('securityCache', () => { expect(api.post).toHaveBeenCalledTimes(1); expect(api.post).toHaveBeenCalledWith(`${SecurityCache.cacheUrl}/refresh`); }); + + it('should make a POST call to the security Provider refresh url', () => { + securityCache.refreshProvider('PROVIDER_ID'); + expect(api.post).toHaveBeenCalledTimes(1); + expect(api.post).toHaveBeenCalledWith(`${SecurityCache.cacheUrl}/PROVIDER_ID/refresh`); + }); }); describe('status', () => {