Skip to content

Commit

Permalink
PIN-3142 Corrected submission tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nttdata-rtorsoli committed Jul 27, 2023
1 parent 69fe859 commit 1964432
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ class AgreementSubmissionSpec extends AnyWordSpecLike with SpecHelper with Scala
val descriptor =
SpecData.publishedDescriptor.copy(agreementApprovalPolicy = Automatic.some, attributes = descriptorAttr)
val eService = SpecData.eService.copy(descriptors = Seq(descriptor), producerId = producerId)
val consumer = SpecData.tenant.copy(id = requesterOrgId, attributes = tenantAttr)
val consumer =
SpecData.tenant.copy(id = requesterOrgId, attributes = tenantAttr, mails = List(SpecData.validEmail))
val producer = SpecData.tenant.copy(id = producerId)
val agreement =
SpecData.draftAgreement.copy(
Expand Down Expand Up @@ -129,7 +130,8 @@ class AgreementSubmissionSpec extends AnyWordSpecLike with SpecHelper with Scala
SpecData.publishedDescriptor.copy(agreementApprovalPolicy = Manual.some, attributes = descriptorAttr)
val eService =
SpecData.eService.copy(producerId = consumerAndProducer, descriptors = Seq(descriptor))
val consumer = SpecData.tenant.copy(id = consumerAndProducer, attributes = tenantAttr)
val consumer =
SpecData.tenant.copy(id = consumerAndProducer, attributes = tenantAttr, mails = List(SpecData.validEmail))
val producer = consumer
val agreement =
SpecData.draftAgreement.copy(
Expand Down Expand Up @@ -282,7 +284,8 @@ class AgreementSubmissionSpec extends AnyWordSpecLike with SpecHelper with Scala

val descriptor = SpecData.publishedDescriptor.copy(attributes = descriptorAttr)
val eService = SpecData.eService.copy(descriptors = Seq(descriptor))
val consumer = SpecData.tenant.copy(id = requesterOrgId, attributes = tenantAttr)
val consumer =
SpecData.tenant.copy(id = requesterOrgId, attributes = tenantAttr, mails = List(SpecData.validEmail))
val agreement =
SpecData.draftAgreement.copy(eserviceId = eService.id, descriptorId = descriptor.id, consumerId = consumer.id)
val payload = AgreementSubmissionPayload(Some("consumer-notes"))
Expand All @@ -304,6 +307,7 @@ class AgreementSubmissionSpec extends AnyWordSpecLike with SpecHelper with Scala
mockAgreementsRetrieve(Nil)
mockEServiceRetrieve(eService.id, eService)
mockTenantRetrieve(consumer.id, consumer)
mockTenantRetrieve(agreement.consumerId, consumer)
mockAgreementUpdate(agreement.id, expectedSeed, agreement)

Get() ~> service.submitAgreement(agreement.id.toString, payload) ~> check {
Expand All @@ -318,7 +322,8 @@ class AgreementSubmissionSpec extends AnyWordSpecLike with SpecHelper with Scala

val descriptor = SpecData.publishedDescriptor.copy(attributes = descriptorAttr)
val eService = SpecData.eService.copy(descriptors = Seq(descriptor))
val consumer = SpecData.tenant.copy(id = requesterOrgId, attributes = tenantAttr)
val consumer =
SpecData.tenant.copy(id = requesterOrgId, attributes = tenantAttr, mails = List(SpecData.validEmail))
val agreement =
SpecData.draftAgreement.copy(eserviceId = eService.id, descriptorId = descriptor.id, consumerId = consumer.id)
val payload = AgreementSubmissionPayload(Some("consumer-notes"))
Expand All @@ -340,6 +345,7 @@ class AgreementSubmissionSpec extends AnyWordSpecLike with SpecHelper with Scala
mockAgreementsRetrieve(Nil)
mockEServiceRetrieve(eService.id, eService)
mockTenantRetrieve(consumer.id, consumer)
mockTenantRetrieve(agreement.consumerId, consumer)
mockAgreementUpdate(agreement.id, expectedSeed, agreement)

Get() ~> service.submitAgreement(agreement.id.toString, payload) ~> check {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ trait SpecHelper extends MockFactory {
mockAttributeManagementServiceRetrieve(SpecData.clientAttribute(UUID.randomUUID()))
mockAttributeManagementServiceRetrieve(SpecData.clientAttribute(UUID.randomUUID()))
mockTenantRetrieve(consumer.id, consumer)
mockTenantRetrieve(agreement.consumerId, consumer)
mockAgreementUpdate(
agreement.id,
expectedSeed,
Expand Down Expand Up @@ -357,6 +358,7 @@ trait SpecHelper extends MockFactory {
mockAgreementsRetrieve(Nil)
mockEServiceRetrieve(eService.id, eService)
mockTenantRetrieve(consumer.id, consumer)
mockTenantRetrieve(agreement.consumerId, consumer)
mockTenantRetrieve(producer.id, producer)
mockAgreementUpdate(
agreement.id,
Expand Down

0 comments on commit 1964432

Please sign in to comment.