diff options
author | Rupinder <rupinsi1@in.ibm.com> | 2020-02-26 15:11:50 +0530 |
---|---|---|
committer | Rupinder <rupinsi1@in.ibm.com> | 2020-02-26 15:13:27 +0530 |
commit | 0ecf3165943135664789f59293145f6847b08c11 (patch) | |
tree | 45341833961f84c593338b686b56ae9b30e76f0b | |
parent | 5d518fdc22faed5d8164c53af24550528c140a9b (diff) |
wrote test cases for security.service.spec.ts
written test cases for security service class
Issue-ID: PORTAL-834
Change-Id: I15179c9d85949ec13ac867a468cb7aa97cf30fd9
Signed-off-by: Rupinder <rupinsi1@in.ibm.com>
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.service.spec.ts | 94 |
1 files changed, 93 insertions, 1 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.service.spec.ts index 3c495ce1..f339dcac 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.service.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.service.spec.ts @@ -1,12 +1,104 @@ import { TestBed } from '@angular/core/testing'; import { SecurityService } from './security.service'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { environment } from 'src/environments/environment'; +import { HttpClient } from '@angular/common/http'; describe('SecurityService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + let service: SecurityService; + + beforeEach(() =>{ TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [SecurityService, HttpClientTestingModule, HttpClient] + }) + service = TestBed.get(SecurityService); +}); it('should be created', () => { const service: SecurityService = TestBed.get(SecurityService); expect(service).toBeTruthy(); }); + + it('should get reportOwnerList', () => { + service.getReportOwnerList().subscribe((resp) => { + expect(resp).toBe(environment.baseUrl + "report/wizard/security/retrieveReportOwner"); + }); + }); + + it('should get getReportRoleList', () => { + service.getReportRoleList().subscribe((resp) => { + expect(resp).toBe(environment.baseUrl + "report/wizard/security/retrieveReportRoleList"); + }); +}); + +it('should get getReportSecurityInfo', () => { + service.getReportSecurityInfo().subscribe((resp) => { + expect(resp).toBe(environment.baseUrl + "report/wizard/security/getReportSecurityInfo"); + }); +}); + +it('should get getReportUserList', () => { + service.getReportUserList().subscribe((resp) => { + expect(resp).toBe(environment.baseUrl + "report/wizard/security/retrieveReportUserList"); + }); +}); + +it('should get getReportSecurityRoles', () => { + service.getReportSecurityRoles().subscribe((resp) => { + expect(resp).toBe(environment.baseUrl + "report/wizard/security/getReportSecurityRoles"); + }); +}); + +it('should get addReportUser', () => { + let userId = "test" + service.addReportUser(userId).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl + "report/security/addReportUser"); + }); +}); + +it('should get removeReportUser', () => { + let userId = "test" + service.removeReportUser(userId).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl + "report/security/removeReportUser"); + }); +}); + +it('should get addUserEditAccess', () => { + let userId = "test" + let readOnly = "dummy" + service.addUserEditAccess(userId, readOnly).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl + "report/security/toggleUserEditAccess/"); + }); +}); + +it('should get addReportRole', () => { + let userId = "test" + service.addReportRole(userId).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl + "report/security/addReportRole"); + }); +}); + +it('should get removeReportRole', () => { + let userId = "test" + service.removeReportRole(userId).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl + "report/security/removeReportRole"); + }); +}); + +it('should get addRoleEditAccess', () => { + let userId = "test" + let readOnly = "dummy" + service.addRoleEditAccess(userId, readOnly).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl + "report/security/toggleRoleEditAccess/"); + }); +}); + +it('should get saveSecurityTabInfo', () => { + let test : any; + service.saveSecurityTabInfo(test).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl + "report/security/updateReportSecurityInfo"); + }); +}); + }); |