From 0ecf3165943135664789f59293145f6847b08c11 Mon Sep 17 00:00:00 2001 From: Rupinder Date: Wed, 26 Feb 2020 15:11:50 +0530 Subject: 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 --- .../Report/security/security.service.spec.ts | 94 +++++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) 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"); + }); +}); + }); -- cgit 1.2.3-korg From 5c1447aec84394049c8be95cafd59b07d96e51f2 Mon Sep 17 00:00:00 2001 From: Rupinder Date: Wed, 26 Feb 2020 15:44:05 +0530 Subject: wrote test cases for profile.service.spec.ts written test cases for profile service class Issue-ID: PORTAL-834 Change-Id: I6920db623e1b967eb9d9d464d671893a7503b4aa Signed-off-by: Rupinder --- .../app/pages/ext/profile/profile.service.spec.ts | 68 +++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.spec.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.spec.ts index 95b69880..7ac3eb5a 100644 --- a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.spec.ts +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.spec.ts @@ -1,12 +1,78 @@ import { TestBed } from '@angular/core/testing'; import { ProfileService } from './profile.service'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClient } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; describe('ProfileService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + + let service: ProfileService; + + beforeEach(() => {TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [ HttpClientTestingModule, HttpClient, ProfileService] + }) + service = TestBed.get(ProfileService); +}); it('should be created', () => { const service: ProfileService = TestBed.get(ProfileService); expect(service).toBeTruthy(); }); + + it('should get getUserPagination', () => { + service.getUserPagination().subscribe((resp) => { + expect(resp).toBe(environment.getUserPagination); + }); + }); + + it('should get getPostSearch', () => { + let test : any; + service.getPostSearch(test).subscribe((resp) => { + expect(resp).toBe(environment.postSearch); + }); + }); + + it('should get importUser', () => { + let test : any; + service.importUser(test).subscribe((resp) => { + expect(resp).toBe(environment.importSearch); + }); }); + +it('should get getPostProfile', () => { + service.getPostProfile().subscribe((resp) => { + expect(resp).toBe(environment.getPostProfile); + }); +}); + +it('should get getSelfProfile', () => { + service.getSelfProfile().subscribe((resp) => { + expect(resp).toBe(environment.getSelfProfile); + }); +}); + +it('should get removeRole', () => { + let data, id; + service.removeRole(data, id).subscribe((resp) => { + expect(resp).toBe(environment.removeUserRole); + }); +}); + +it('should get addUserRole', () => { + let data, id; + service.addUserRole(data, id).subscribe((resp) => { + expect(resp).toBe(environment.addUserRole); + }); +}); + +it('should get toggleProfileActive', () => { + let data, id; + service.toggleProfileActive(id).subscribe((resp) => { + expect(resp).toBe(environment); + }); +}); + +}); + -- cgit 1.2.3-korg From 90c70e89f3756599e9332d1112a044244315cd4a Mon Sep 17 00:00:00 2001 From: Rupinder Date: Wed, 26 Feb 2020 16:08:21 +0530 Subject: wrote test cases for sql.service.spec.ts Written test cases for sql service class Issue-ID: PORTAL-834 Change-Id: I101212154375eefef05c53995b6f32bf4e130486 Signed-off-by: Rupinder --- .../Report_List/Report/sql/sql.service.spec.ts | 29 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.service.spec.ts index 57db6fb6..68978d90 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.service.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.service.spec.ts @@ -2,15 +2,36 @@ import { TestBed } from '@angular/core/testing'; import { SqlService } from './sql.service'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClient } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; describe('SqlService', () => { - beforeEach(() => - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule] - })); + + let service: SqlService; + + beforeEach(() => {TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [SqlService, HttpClient, HttpClientTestingModule] + }) + service = TestBed.get(SqlService); +}); it('should be created', () => { const service: SqlService = TestBed.get(SqlService); expect(service).toBeTruthy(); }); + + it('should getSQLTabData', () => { + service.getSQLTabData("test").subscribe((res) => { + expect(res).toBe(environment); + }); + }); + + it('should postSQLValidateAndSave', () => { + service.postSQLValidateAndSave("test").subscribe((res) => { + expect(res).toBe(environment) + }); + }); + + }); -- cgit 1.2.3-korg From 776423bd10d7c1e9325b1c1a1475f7b1f6cf4547 Mon Sep 17 00:00:00 2001 From: Rupinder Date: Wed, 26 Feb 2020 16:36:55 +0530 Subject: wrote test cases for run and log service classes Written test cases for run and log servie classes Issue-ID: PORTAL-834 Change-Id: I6843851b3bea32c9be495209a81dd310f630a7ad Signed-off-by: Rupinder --- .../Report_List/Report/log/log.service.spec.ts | 21 +++++++++- .../Report_List/Report/run/run.service.spec.ts | 49 +++++++++++++++++++++- 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.service.spec.ts index d7b3b648..872a5de4 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.service.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.service.spec.ts @@ -2,15 +2,32 @@ import { TestBed } from '@angular/core/testing'; import { LogService } from './log.service'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClient } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; describe('LogService', () => { + + let service: LogService + beforeEach(() => + { TestBed.configureTestingModule({ - imports: [HttpClientTestingModule] - })); + imports: [HttpClientTestingModule], + providers: [LogService, HttpClient, HttpClientTestingModule] + }) + service = TestBed.get(LogService); + +}); it('should be created', () => { const service: LogService = TestBed.get(LogService); expect(service).toBeTruthy(); }); + + it('should getLogData', () => { + service.getLogData("test").subscribe((res) => { + expect(res).toBe(environment.baseUrl); + }); + }); + }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.spec.ts index b50fc923..45bf2433 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.spec.ts @@ -2,15 +2,60 @@ import { TestBed } from '@angular/core/testing'; import { RunService } from './run.service'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClient } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; describe('RunService', () => { + let service: RunService; + beforeEach(() => + { TestBed.configureTestingModule({ - imports: [HttpClientTestingModule] - })); + imports: [HttpClientTestingModule], + providers: [HttpClient, HttpClientTestingModule, RunService] + }); + + service = TestBed.get(RunService); +}); it('should be created', () => { const service: RunService = TestBed.get(RunService); expect(service).toBeTruthy(); }); + + it('should getReportData', () => { + service.getReportData("test").subscribe((res) => { + expect(res).toBe(environment); + }); + }); + + it('should getReportDataWithFormFields', () => { + service.getReportDataWithFormFields("just", "testing").subscribe((res) => { + expect(res).toBe(environment); + }); + }); + + it('should getDefinitionPageDetails', () => { + service.getDefinitionPageDetails(1).subscribe((res) => { + expect(res).toBe(environment); + }); + }); + + it('should refreshFormFields', () => { + service.refreshFormFields("just", "testing").subscribe((res) => { + expect(res).toBe(environment); + }); + }); + + it('should getFormFieldGroupsData', () => { + service.getFormFieldGroupsData("test").subscribe((res) => { + expect(res).toBe(environment); + }); + }); + + it('should downloadReportExcel', () => { + service.downloadReportExcel("test").subscribe((res) => { + expect(res).toBe(new Blob); + }); + }); }); -- cgit 1.2.3-korg