-
Notifications
You must be signed in to change notification settings - Fork 5
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
Sc-8652: Handle Expired Certificates in Certman #972
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
852fa56
WIP
9fac58d
updated certs.go, need to add tests
94a80c4
working on tests
f43f1e8
fixed testing issue
f1d01fc
Merge branch 'main' into sc-8652
54add36
updates based on PR review
b697cc5
Merge branch 'sc-8652' of https://github.com/trisacrypto/directory in…
77f661a
small docstring update
242c7c2
Merge branch 'main' into sc-8652
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,9 +276,10 @@ func (s *certTestSuite) TestCertManagerSevenDayReissuanceReminder() { | |
require.NoError(err, "could not get hotel VASP") | ||
hotelVASP = s.setupVASP(hotelVASP) | ||
|
||
// Call the certman function at 6 days, which will send | ||
// the seven day cert reissuance reminder to echoVASP. | ||
// Call the certman function at 6 days and 1 day, which will send seven day | ||
// cert reissuance reminders to charlieVASP and hotelVASP. | ||
s.updateVaspIdentityCert(charlieVASP, 6) | ||
s.updateVaspIdentityCert(hotelVASP, 1) | ||
callTime := time.Now() | ||
s.certman.HandleCertificateReissuance() | ||
|
||
|
@@ -312,6 +313,36 @@ func (s *certTestSuite) TestCertManagerSevenDayReissuanceReminder() { | |
emails.CheckEmails(s.T(), messages) | ||
} | ||
|
||
func (s *certTestSuite) TestCertManagerExpiration() { | ||
s.setupCertManager(sectigo.ProfileCipherTraceEE, fixtures.Small) | ||
defer s.teardownCertManager() | ||
defer s.fixtures.LoadReferenceFixtures() | ||
require := s.Require() | ||
|
||
// setup the datastore to contain the modified hotelVASP | ||
hotelVASP, err := s.fixtures.GetVASP("hotel") | ||
require.NoError(err, "could not get hotel VASP") | ||
hotelVASP = s.setupVASP(hotelVASP) | ||
|
||
certID := models.GetCertID(hotelVASP.IdentityCertificate) | ||
cert := &models.Certificate{ | ||
Id: certID, | ||
Status: models.CertificateState_ISSUED, | ||
} | ||
err = s.db.UpdateCert(cert) | ||
require.NoError(err) | ||
|
||
// Run the loop again to ensure that emails are not resent to contacts | ||
s.certman.HandleCertificateReissuance() | ||
|
||
cert, err = s.db.RetrieveCert(certID) | ||
require.NoError(err) | ||
require.Equal(cert.Status, models.CertificateState_EXPIRED) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep, see the above comment. |
||
|
||
// Ensure that emails have been sent with the mock email client. | ||
emails.CheckEmails(s.T(), []*emails.EmailMeta{}) | ||
} | ||
|
||
func (s *certTestSuite) TestCertManagerReissuance() { | ||
require := s.Require() | ||
|
||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this test failing? I don't understand why this line is necessary now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, hotelVASP's cert is expired so it was triggering the
<= 7 days before expiration
case by default, but now since we have a<= 0 days before expiration
case it was triggering that and throwing off the expected emails and causing the test to fail, so I added this line to update it's cert expiration.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes complete sense, thanks.