-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API-7700: add ActorType responsible for last action (#517)
* API-7700: add ActorType responsible for last action to Applications response * API-7700: pr-bot comment * API-7700: shuffling code to make it more compliant with what's already there
- Loading branch information
1 parent
027059d
commit 939fcbf
Showing
7 changed files
with
104 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,5 +192,66 @@ class StateHistoryRepositoryISpec | |
savedStateHistories shouldBe List(stateHistory) | ||
} | ||
} | ||
"fetchDeletedByApplicationIds" should { | ||
"fetch a single deleted application" in { | ||
val requesterEmail = "[email protected]".toLaxEmail | ||
val appId = ApplicationId.random | ||
val ts = instant | ||
val actor: Actor = Actors.AppCollaborator(requesterEmail) | ||
|
||
val stateHistory = StateHistory(appId, State.DELETED, actor, Some(State.PENDING_RESPONSIBLE_INDIVIDUAL_VERIFICATION), changedAt = ts) | ||
|
||
val result = await(repository.insert(stateHistory)) | ||
result shouldBe stateHistory | ||
|
||
val retrieved = await(repository.fetchDeletedByApplicationIds(List(appId, ApplicationId.random))) | ||
retrieved.size shouldBe 1 | ||
retrieved.head shouldBe stateHistory | ||
} | ||
"fetch multiple deleted applications" in { | ||
val requesterEmail = "[email protected]".toLaxEmail | ||
val appId = ApplicationId.random | ||
val appId2 = ApplicationId.random | ||
val appId3 = ApplicationId.random | ||
val ts = instant | ||
val actor: Actor = Actors.AppCollaborator(requesterEmail) | ||
|
||
val stateHistory = StateHistory(appId, State.DELETED, actor, Some(State.PENDING_RESPONSIBLE_INDIVIDUAL_VERIFICATION), changedAt = ts) | ||
val stateHistory2 = stateHistory.copy(applicationId = appId2) | ||
val stateHistory3 = stateHistory.copy(applicationId = appId3) | ||
|
||
await(repository.insert(stateHistory)) | ||
await(repository.insert(stateHistory2)) | ||
await(repository.insert(stateHistory3)) | ||
|
||
val retrieved = await(repository.fetchDeletedByApplicationIds(List(appId, appId2, appId3))) | ||
retrieved.size shouldBe 3 | ||
retrieved should contain(stateHistory) | ||
retrieved should contain(stateHistory2) | ||
retrieved should contain(stateHistory3) | ||
} | ||
|
||
"fetch multiple deleted applications and none in other states" in { | ||
val requesterEmail = "[email protected]".toLaxEmail | ||
val appId = ApplicationId.random | ||
val appId2 = ApplicationId.random | ||
val appId3 = ApplicationId.random | ||
val ts = instant | ||
val actor: Actor = Actors.AppCollaborator(requesterEmail) | ||
|
||
val stateHistory = StateHistory(appId, State.DELETED, actor, Some(State.PENDING_RESPONSIBLE_INDIVIDUAL_VERIFICATION), changedAt = ts) | ||
val stateHistory2 = stateHistory.copy(applicationId = appId2) | ||
val stateHistory3 = stateHistory.copy(applicationId = appId3, state = State.PENDING_GATEKEEPER_APPROVAL) | ||
|
||
await(repository.insert(stateHistory)) | ||
await(repository.insert(stateHistory2)) | ||
await(repository.insert(stateHistory3)) | ||
|
||
val retrieved = await(repository.fetchDeletedByApplicationIds(List(appId, appId2, appId3))) | ||
retrieved.size shouldBe 2 | ||
retrieved should contain(stateHistory) | ||
retrieved should contain(stateHistory2) | ||
retrieved should not contain stateHistory3 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters