Skip to content

Commit

Permalink
Add test for #3244 (#3248)
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer authored Nov 19, 2024
1 parent 25d8a0d commit fa2cfe1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ fun SequenceEntryStatus.assertHasError(error: Boolean): SequenceEntryStatus {
return this
}

fun SequenceEntryStatus.assertSubmitterIs(submitter: String): SequenceEntryStatus {
assertThat(this.submitter, `is`(submitter))
return this
}

fun expectUnauthorizedResponse(isModifyingRequest: Boolean = false, apiCall: (jwt: String?) -> ResultActions) {
val response = apiCall(null)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import org.loculus.backend.controller.DEFAULT_ORGANISM
import org.loculus.backend.controller.DEFAULT_USER_NAME
import org.loculus.backend.controller.EndpointTest
import org.loculus.backend.controller.OTHER_ORGANISM
import org.loculus.backend.controller.SUPER_USER_NAME
import org.loculus.backend.controller.assertStatusIs
import org.loculus.backend.controller.assertSubmitterIs
import org.loculus.backend.controller.expectUnauthorizedResponse
import org.loculus.backend.controller.generateJwtFor
import org.loculus.backend.controller.jwtForSuperUser
Expand Down Expand Up @@ -36,7 +38,7 @@ class RevokeEndpointTest(
}

@Test
fun `GIVEN entries with 'APPROVED_FOR_RELEASE' THEN returns revocation version in status AWAITING_APPROVAL`() {
fun `GIVEN entries with 'APPROVED_FOR_RELEASE' THEN returns revocation version in status PROCESSED`() {
val accessions = convenienceClient.prepareDefaultSequenceEntriesToApprovedForRelease().map { it.accession }

client.revokeSequenceEntries(accessions)
Expand All @@ -48,6 +50,7 @@ class RevokeEndpointTest(

convenienceClient.getSequenceEntry(accession = accessions.first(), version = 2)
.assertStatusIs(PROCESSED)
.assertSubmitterIs(DEFAULT_USER_NAME)
}

@Test
Expand Down Expand Up @@ -94,7 +97,7 @@ class RevokeEndpointTest(
}

@Test
fun `WHEN superuser revokes entries of other group THEN revocation version is created`() {
fun `WHEN superuser revokes entries of other group THEN superuser is submitter of revocation entry`() {
val accessions = convenienceClient
.prepareDefaultSequenceEntriesToApprovedForRelease(username = DEFAULT_USER_NAME)
.map { it.accession }
Expand All @@ -108,6 +111,7 @@ class RevokeEndpointTest(

convenienceClient.getSequenceEntry(accession = accessions.first(), version = 2)
.assertStatusIs(PROCESSED)
.assertSubmitterIs(SUPER_USER_NAME)
}

@Test
Expand Down

0 comments on commit fa2cfe1

Please sign in to comment.