diff --git a/docs/dev/mockoon.json b/docs/dev/mockoon.json index 132dd8c81..e1eda3d0f 100644 --- a/docs/dev/mockoon.json +++ b/docs/dev/mockoon.json @@ -490,7 +490,7 @@ }, { "uuid": "0422d383-e901-4d38-966b-f3b4653bb5c9", - "body": "{\n \"status\": \"Non-Compliant\",\n \"device\": {{data 'cntg' '0'}},\n \"started\": \"2023-06-22T09:20:00.123Z\",\n \"finished\": \"2023-06-22T09:26:00.123Z\",\n \"report\": \"report/f0d4e2f2f541_2026-02-02T17:24:52\",\n \"export\": \"export/f0d4e2f2f541_2026-02-02T17:24:52\",\n \"tests\": {\n \"total\": 26,\n \"results\": [\n {\n \"name\": \"dns.network.hostname_resolution\",\n \"description\": \"The device should resolve hostnames\",\n \"result\": \"Non-Compliant\",\n \"required_result\": \"Compliant\"\n \"recommendations\": [\n \"An example of a step to resolve\",\n \"Disable any running NTP server\"\n ]\n },\n {\n \"name\": \"dns.network.from_dhcp\",\n \"description\": \"The device should use the DNS server provided by the DHCP server\",\n \"result\": \"Compliant\",\n \"required_result\": \"Roadmap\"\n },\n {\n \"name\": \"security.services.ftp\",\n \"description\": \"FTP server should not be available\",\n \"result\": \"Compliant\",\n \"required_result\": \"Required\"\n }\n ]\n }\n}", + "body": "{\n \"status\": \"Non-Compliant\",\n \"device\": {{data 'cntg' '0'}},\n \"started\": \"2023-06-22T09:20:00.123Z\",\n \"finished\": \"2023-06-22T09:26:00.123Z\",\n \"report\": \"/report/f0d4e2f2f541_2026-02-02T17:24:52\",\n \"export\": \"/export/f0d4e2f2f541_2026-02-02T17:24:52\",\n \"tests\": {\n \"total\": 26,\n \"results\": [\n {\n \"name\": \"dns.network.hostname_resolution\",\n \"description\": \"The device should resolve hostnames\",\n \"result\": \"Non-Compliant\",\n \"required_result\": \"Compliant\"\n \"recommendations\": [\n \"An example of a step to resolve\",\n \"Disable any running NTP server\"\n ]\n },\n {\n \"name\": \"dns.network.from_dhcp\",\n \"description\": \"The device should use the DNS server provided by the DHCP server\",\n \"result\": \"Compliant\",\n \"required_result\": \"Roadmap\"\n },\n {\n \"name\": \"security.services.ftp\",\n \"description\": \"FTP server should not be available\",\n \"result\": \"Compliant\",\n \"required_result\": \"Required\"\n }\n ]\n }\n}", "latency": 0, "statusCode": 200, "label": "Test Run Non-Compliant", @@ -509,7 +509,7 @@ }, { "uuid": "46e4d42e-823b-440f-9c59-d344c0f51019", - "body": "{\n \"status\": \"Compliant\",\n \"device\": {{data 'cntg' '0'}},\n \"started\": \"2023-06-22T09:20:00.123Z\",\n \"finished\": \"2023-06-22T09:26:00.123Z\",\n \"report\": \"report/f0d4e2f2f541_2026-02-02T17:24:52\",\n \"export\": \"export/f0d4e2f2f541_2026-02-02T17:24:52\",\n \"tests\": {\n \"total\": 3,\n \"results\": [\n {\n \"name\": \"dns.network.hostname_resolution\",\n \"description\": \"The device should resolve hostnames\",\n \"result\": \"Compliant\",\n \"required_result\": \"Required\"\n },\n {\n \"name\": \"dns.network.from_dhcp\",\n \"description\": \"The device should use the DNS server provided by the DHCP server\",\n \"result\": \"Feature Not Present\",\n \"required_result\": \"Roadmap\"\n },\n {\n \"name\": \"security.services.ftp\",\n \"description\": \"FTP server should not be available\",\n \"result\": \"Compliant\",\n \"required_result\": \"Required\"\n }\n ]\n }\n}", + "body": "{\n \"status\": \"Compliant\",\n \"device\": {{data 'cntg' '0'}},\n \"started\": \"2023-06-22T09:20:00.123Z\",\n \"finished\": \"2023-06-22T09:26:00.123Z\",\n \"report\": \"/report/f0d4e2f2f541_2026-02-02T17:24:52\",\n \"export\": \"/export/f0d4e2f2f541_2026-02-02T17:24:52\",\n \"tests\": {\n \"total\": 3,\n \"results\": [\n {\n \"name\": \"dns.network.hostname_resolution\",\n \"description\": \"The device should resolve hostnames\",\n \"result\": \"Compliant\",\n \"required_result\": \"Required\"\n },\n {\n \"name\": \"dns.network.from_dhcp\",\n \"description\": \"The device should use the DNS server provided by the DHCP server\",\n \"result\": \"Feature Not Present\",\n \"required_result\": \"Roadmap\"\n },\n {\n \"name\": \"security.services.ftp\",\n \"description\": \"FTP server should not be available\",\n \"result\": \"Compliant\",\n \"required_result\": \"Required\"\n }\n ]\n }\n}", "latency": 0, "statusCode": 200, "label": "Testrun Compliant", @@ -605,7 +605,7 @@ "responses": [ { "uuid": "3cd002ad-a8fa-4a35-860b-b2902a8c6c4e", - "body": "[\n {\n \"testrun\": {\n \"version\": \"2.2.2\"\n },\n \"device\": {{data 'cntg' '0'}},\n \"status\": \"Non-Compliant\",\n \"started\": \"2026-02-02 17:24:52\",\n \"finished\": \"2026-02-02 17:34:58\",\n \"report\": \"report/f0d4e2f2f541_2026-02-02T17:24:52\",\n \"export\": \"export/f0d4e2f2f541_2026-02-02T17:24:52\",\n \"folder_name\": \"f0d4e2f2f541_2026-02-02T17:24:52\",\n \"delete\": \"report/f0d4e2f2f541_2026-02-02T17:24:52\"\n }\n]", + "body": "[\n {\n \"testrun\": {\n \"version\": \"2.2.2\"\n },\n \"device\": {{data 'cntg' '0'}},\n \"status\": \"Non-Compliant\",\n \"started\": \"2026-02-02 17:24:52\",\n \"finished\": \"2026-02-02 17:34:58\",\n \"report\": \"/report/f0d4e2f2f541_2026-02-02T17:24:52\",\n \"export\": \"/export/f0d4e2f2f541_2026-02-02T17:24:52\",\n \"folder_name\": \"f0d4e2f2f541_2026-02-02T17:24:52\",\n \"delete\": \"/report/f0d4e2f2f541_2026-02-02T17:24:52\"\n }\n]", "latency": 0, "statusCode": 200, "label": "", diff --git a/make/DEBIAN/control b/make/DEBIAN/control index a43deb455..c9b25857f 100644 --- a/make/DEBIAN/control +++ b/make/DEBIAN/control @@ -1,5 +1,5 @@ Package: Testrun -Version: 2.3.3 +Version: 2.3.4-beta.1 Architecture: amd64 Maintainer: Google Homepage: https://github.com/google/testrun diff --git a/modules/ui/src/app/app.store.spec.ts b/modules/ui/src/app/app.store.spec.ts index 301a3d5b2..4c89c8d95 100644 --- a/modules/ui/src/app/app.store.spec.ts +++ b/modules/ui/src/app/app.store.spec.ts @@ -535,7 +535,7 @@ describe('AppStore', () => { }, started: '2023-06-22T09:20:00.123Z', finished: '2023-06-22T09:26:00.123Z', - report: 'report/123', + report: '/report/123', export: 'https://api.testrun.io/export.pdf', tags: [], tests: { diff --git a/modules/ui/src/app/components/download-report-pdf/download-report-pdf.component.spec.ts b/modules/ui/src/app/components/download-report-pdf/download-report-pdf.component.spec.ts index a030f6dc2..5fc3493b4 100644 --- a/modules/ui/src/app/components/download-report-pdf/download-report-pdf.component.spec.ts +++ b/modules/ui/src/app/components/download-report-pdf/download-report-pdf.component.spec.ts @@ -76,7 +76,7 @@ describe('DownloadReportComponent', () => { ) as HTMLAnchorElement; expect(downloadReportLink).not.toBeNull(); - expect(downloadReportLink.href).toContain('report/123'); + expect(downloadReportLink.href).toContain('/report/123'); expect(downloadReportLink.download).toEqual( 'delta_03-din-cpu_1.2.2_compliant_22_jun_2023_9:20' ); diff --git a/modules/ui/src/app/components/download-report/download-report.component.spec.ts b/modules/ui/src/app/components/download-report/download-report.component.spec.ts index 7b16cdce3..cc41dc434 100644 --- a/modules/ui/src/app/components/download-report/download-report.component.spec.ts +++ b/modules/ui/src/app/components/download-report/download-report.component.spec.ts @@ -136,7 +136,7 @@ describe('DownloadReportComponent', () => { ) as HTMLAnchorElement; expect(downloadReportLink).not.toBeNull(); - expect(downloadReportLink.href).toContain('report/123'); + expect(downloadReportLink.href).toContain('/report/123'); expect(downloadReportLink.download).toEqual( 'delta_03-din-cpu_1.2.2_compliant_22_jun_2023_9:20' ); diff --git a/modules/ui/src/app/components/testing-complete/testing-complete.component.spec.ts b/modules/ui/src/app/components/testing-complete/testing-complete.component.spec.ts index 7622d3977..909613b0f 100644 --- a/modules/ui/src/app/components/testing-complete/testing-complete.component.spec.ts +++ b/modules/ui/src/app/components/testing-complete/testing-complete.component.spec.ts @@ -65,7 +65,7 @@ describe('TestingCompleteComponent', () => { profiles: [], testrunStatus: MOCK_PROGRESS_DATA_COMPLIANT, isTestingComplete: true, - report: 'report/123', + report: '/report/123', export: '', isPilot: false, }, diff --git a/modules/ui/src/app/mocks/reports.mock.ts b/modules/ui/src/app/mocks/reports.mock.ts index 3de61cc84..af72f5346 100644 --- a/modules/ui/src/app/mocks/reports.mock.ts +++ b/modules/ui/src/app/mocks/reports.mock.ts @@ -14,9 +14,9 @@ export const HISTORY = [ firmware: '1.2.2', test_pack: TestingType.Qualification, }, - report: 'report/123', - export: 'export/123', - delete: 'report/123', + report: '/report/123', + export: '/export/123', + delete: '/report/123', started: '2023-06-23T10:11:00.123Z', finished: '2023-06-23T10:17:10.123Z', }, @@ -31,9 +31,9 @@ export const HISTORY = [ firmware: '1.2.3', test_pack: TestingType.Qualification, }, - report: 'report/1234', - export: 'export/1234', - delete: 'report/1234', + report: '/report/1234', + export: '/export/1234', + delete: '/report/1234', started: '2023-07-23T10:11:00.123Z', finished: '2023-07-23T10:17:10.123Z', }, @@ -48,9 +48,9 @@ export const HISTORY = [ firmware: '1.2.2', test_pack: TestingType.Qualification, }, - report: 'report/12345', - export: 'export/12345', - delete: 'report/12345', + report: '/report/12345', + export: '/export/12345', + delete: '/report/12345', started: '2023-06-23T10:11:00.123Z', finished: '2023-06-23T10:17:10.123Z', }, @@ -68,9 +68,9 @@ export const HISTORY_AFTER_REMOVE = [ firmware: '1.2.2', test_pack: TestingType.Qualification, }, - report: 'report/123', - export: 'export/123', - delete: 'report/123', + report: '/report/123', + export: '/export/123', + delete: '/report/123', started: '2023-06-23T10:11:00.123Z', finished: '2023-06-23T10:17:10.123Z', }, @@ -85,9 +85,9 @@ export const HISTORY_AFTER_REMOVE = [ firmware: '1.2.2', test_pack: TestingType.Qualification, }, - report: 'report/12345', - export: 'export/12345', - delete: 'report/12345', + report: '/report/12345', + export: '/export/12345', + delete: '/report/12345', started: '2023-06-23T10:11:00.123Z', finished: '2023-06-23T10:17:10.123Z', }, @@ -105,9 +105,9 @@ export const FORMATTED_HISTORY = [ firmware: '1.2.2', test_pack: TestingType.Qualification, }, - report: 'report/123', - export: 'export/123', - delete: 'report/123', + report: '/report/123', + export: '/export/123', + delete: '/report/123', started: '2023-06-23T10:11:00.123Z', finished: '2023-06-23T10:17:10.123Z', deviceFirmware: '1.2.2', @@ -127,9 +127,9 @@ export const FORMATTED_HISTORY = [ firmware: '1.2.3', test_pack: TestingType.Qualification, }, - report: 'report/1234', - export: 'export/1234', - delete: 'report/1234', + report: '/report/1234', + export: '/export/1234', + delete: '/report/1234', started: '2023-07-23T10:11:00.123Z', finished: '2023-07-23T10:17:10.123Z', deviceFirmware: '1.2.3', @@ -149,9 +149,9 @@ export const FORMATTED_HISTORY = [ firmware: '1.2.2', test_pack: TestingType.Qualification, }, - report: 'report/12345', - export: 'export/12345', - delete: 'report/12345', + report: '/report/12345', + export: '/export/12345', + delete: '/report/12345', started: '2023-06-23T10:11:00.123Z', finished: '2023-06-23T10:17:10.123Z', deviceFirmware: '1.2.2', diff --git a/modules/ui/src/app/mocks/testrun.mock.ts b/modules/ui/src/app/mocks/testrun.mock.ts index bcf41c929..8ebab02dc 100644 --- a/modules/ui/src/app/mocks/testrun.mock.ts +++ b/modules/ui/src/app/mocks/testrun.mock.ts @@ -131,7 +131,7 @@ export const MOCK_PROGRESS_DATA_COMPLIANT: TestrunStatus = StatusOfTestrun.Complete, '2023-06-22T09:20:00.123Z', TEST_DATA, - 'report/123', + '/report/123', ResultOfTestrun.Compliant ); @@ -140,7 +140,7 @@ export const MOCK_PROGRESS_DATA_NON_COMPLIANT: TestrunStatus = StatusOfTestrun.Complete, '2023-06-22T09:20:00.123Z', TEST_DATA_RESULT, - 'report/123', + '/report/123', ResultOfTestrun.NonCompliant ); @@ -148,7 +148,7 @@ export const MOCK_PROGRESS_DATA_PROCEED: TestrunStatus = PROGRESS_DATA_RESPONSE( StatusOfTestrun.Proceed, '2023-06-22T09:20:00.123Z', TEST_DATA_RESULT, - 'report/123', + '/report/123', ResultOfTestrun.Compliant ); diff --git a/modules/ui/src/app/pages/reports/reports.component.spec.ts b/modules/ui/src/app/pages/reports/reports.component.spec.ts index c2ab6eb6b..d95d381fc 100644 --- a/modules/ui/src/app/pages/reports/reports.component.spec.ts +++ b/modules/ui/src/app/pages/reports/reports.component.spec.ts @@ -296,7 +296,7 @@ describe('ReportsComponent', () => { it('#removeDevice should call delete report', () => { const data = HISTORY[0]; component.removeReport(data); - expect(mockReportsStore.deleteReport).toHaveBeenCalledWith('report/123'); + expect(mockReportsStore.deleteReport).toHaveBeenCalledWith('/report/123'); }); }); diff --git a/modules/ui/src/app/pages/reports/reports.store.spec.ts b/modules/ui/src/app/pages/reports/reports.store.spec.ts index 228518deb..fc76a45a7 100644 --- a/modules/ui/src/app/pages/reports/reports.store.spec.ts +++ b/modules/ui/src/app/pages/reports/reports.store.spec.ts @@ -181,7 +181,7 @@ describe('ReportsStore', () => { store.overrideSelector(selectReports, [...HISTORY]); store.refreshState(); - reportsStore.deleteReport('report/1234'); + reportsStore.deleteReport('/report/1234'); expect(store.dispatch).toHaveBeenCalledWith( setReports({ reports: HISTORY_AFTER_REMOVE }) @@ -194,7 +194,7 @@ describe('ReportsStore', () => { store.overrideSelector(selectReports, [...HISTORY_AFTER_REMOVE]); store.refreshState(); - reportsStore.deleteReport('report/12345'); + reportsStore.deleteReport('/report/12345'); expect(store.dispatch).toHaveBeenCalledWith( setReports({ reports: [HISTORY_AFTER_REMOVE[0]] }) diff --git a/modules/ui/src/app/services/test-run.service.spec.ts b/modules/ui/src/app/services/test-run.service.spec.ts index 9e1850209..feb33b938 100644 --- a/modules/ui/src/app/services/test-run.service.spec.ts +++ b/modules/ui/src/app/services/test-run.service.spec.ts @@ -232,7 +232,7 @@ describe('TestRunService', () => { { status: 'Complete', device: device, - report: 'report/123', + report: '/report/123', started: '2023-06-22T10:11:00.123Z', finished: '2023-06-22T10:17:00.123Z', }, @@ -462,7 +462,7 @@ describe('TestRunService', () => { it('deleteReport should have necessary request data', () => { const apiUrl = 'http://localhost:8000/report'; - service.deleteReport('report').subscribe(res => { + service.deleteReport('http://localhost:8000/report').subscribe(res => { expect(res).toEqual(true); }); @@ -474,7 +474,7 @@ describe('TestRunService', () => { it('deleteReport should return false when error happens', () => { const apiUrl = 'http://localhost:8000/report'; - service.deleteReport('report').subscribe(res => { + service.deleteReport('http://localhost:8000/report').subscribe(res => { expect(res).toEqual(false); }); diff --git a/modules/ui/src/app/services/test-run.service.ts b/modules/ui/src/app/services/test-run.service.ts index b8142fecd..d19dd6528 100644 --- a/modules/ui/src/app/services/test-run.service.ts +++ b/modules/ui/src/app/services/test-run.service.ts @@ -244,11 +244,11 @@ export class TestRunService { } getReportLink(url: string): string { - return `${API_URL}/${url}`; + return `${url}`; } deleteReport(url: string): Observable { - return this.http.delete(`${API_URL}/${url}`).pipe( + return this.http.delete(`${url}`).pipe( catchError(() => of(false)), map(res => !!res) );