예제 #1
0
        public async Task Can_Get_GDPRExportReport_With_All_Fields_Set()
        {
            //Arrange
            var       sensitiveDataLevel        = A <SensitiveDataLevel>();
            var       datahandlerContractTypeId = "5";
            const int organizationId            = TestEnvironment.DefaultOrganizationId;
            var       system = await ItSystemHelper.CreateItSystemInOrganizationAsync(A <string>(), organizationId, AccessModifier.Public);

            var usage = await ItSystemHelper.TakeIntoUseAsync(system.Id, organizationId);

            var dataProcessingRegistrationDto = await DataProcessingRegistrationHelper.CreateAsync(organizationId, A <string>());

            await DataProcessingRegistrationHelper.SendChangeIsAgreementConcludedRequestAsync(dataProcessingRegistrationDto.Id, YesNoIrrelevantOption.YES);

            using var setSystemResponse = await DataProcessingRegistrationHelper.SendAssignSystemRequestAsync(dataProcessingRegistrationDto.Id, usage.Id);

            Assert.Equal(HttpStatusCode.OK, setSystemResponse.StatusCode);
            var body = new
            {
                HostedAt             = A <HostedAt>(),
                IsBusinessCritical   = A <DataOptions>(),
                DataProcessorControl = A <DataOptions>(),
                RiskAssessment       = A <DataOptions>(),
                PreRiskAssessment    = A <RiskLevel>(),
                DPIA = A <DataOptions>()
            };
            var contract = await ItContractHelper.CreateContract(A <string>(), organizationId);

            await ItContractHelper.PatchContract(contract.Id, organizationId, new { contractTypeId = datahandlerContractTypeId });

            await ItContractHelper.AddItSystemUsage(contract.Id, usage.Id, organizationId);

            await ItSystemUsageHelper.PatchSystemUsage(usage.Id, organizationId, body);

            await ItSystemUsageHelper.AddSensitiveDataLevel(usage.Id, sensitiveDataLevel);

            var expectedUsage = await ItSystemHelper.GetItSystemUsage(usage.Id);

            //Act
            var report = await ItSystemUsageHelper.GetGDPRExportReport(organizationId);

            //Assert
            var gdprExportReport = Assert.Single(report.Where(x => x.Name == system.Name));

            AssertCorrectGdprExportReport(expectedUsage, gdprExportReport, true);
            AssertSensitiveDataLevel(sensitiveDataLevel, gdprExportReport);
        }
예제 #2
0
 private static async Task <ItSystemUsageSimpleDTO> AddItSystemUsageToContractAsync(ItContractDTO contract, ItSystemUsageDTO systemUsage, int organizationId = TestEnvironment.DefaultOrganizationId)
 {
     return(await ItContractHelper.AddItSystemUsage(contract.Id, systemUsage.Id, organizationId));
 }