Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DR2-1982 Remove mockito from rotate password #341

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

MancunianSam
Copy link
Contributor

@MancunianSam MancunianSam commented Nov 8, 2024

This needs nationalarchives/da-aws-clients#330 before the tests will pass

Copy link
Contributor

@techncl techncl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just some minor comments.

new Lambda().handler(rotationEvent, config, dependencies).unsafeRunSync()

verify(userClient, times(1)).testNewPassword()
res.left.value.getMessage should equal("Password test failed")
}

"handler finishSecret" should "return an error if the pending secret has no version" in {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test doesn't return an error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, copy and paste error I think. I've changed it.

new Lambda().handler(rotationEvent, config, dependencies).unsafeRunSync()

verify(secretsManagerClient, times(0)).putSecretValue(any[String], any[Stage], any[Option[String]])(using any[Encoder[String]])
secretResult.versionToStage.size should equal(1)
}

"handler createSecret" should "putSecretValue if a Pending value does not already exist" in {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you didn't do this in this PR, but should this be "calls putSecretValue"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so because we're not checking the method is called. It is a bit odd the way it is though so I've gone with "create the secret value if a Pending value does not already exist"

new Lambda().handler(rotationEvent, config, dependencies).unsafeRunSync()

verify(secretsManagerClient, times(0)).putSecretValue(any[String], any[Stage], any[Option[String]])(using any[Encoder[String]])
secretResult.versionToStage.size should equal(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth checking the password is still the same/the expected one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's slightly superfluous but one extra line doesn't hurt. I've added it in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants