[GT-157] Drop messages from banned dns, and add tests for messages saving to the correct queue#238
Open
[GT-157] Drop messages from banned dns, and add tests for messages saving to the correct queue#238
Conversation
- compares message signer with dns in banned dns list - which is got from config file and sorted through
- now makes more sense - has an error message - reworking of some if/elif/else statements
Contributor
Author
|
unit tests to be written |
Contributor
Author
|
Pushed what I was working on as going on holiday |
Contributor
Author
- Mock out the _handle_msg() function called by _save_msg_to_queue() (the function we are testing), as it fails due to client signers and certificates not matching. - It is easier to mock out the failing function instead, as it is not the function we are testing in this test. - To test _save_msg_to_queue, we are assuming the message's certificate and signer match.
- this was outdated code no longer in use
Contributor
Author
- we can check the log output matches an expected string - to check the test has passed or failed
Contributor
Author
Contributor
Author
- also re-adds the creation of the certificate which was missing
Contributor
Author
tofu-rocketry
requested changes
Sep 21, 2023
test/test_ssm.py
Outdated
| for dn in valid_dns: | ||
| # Capture the log output so we can use it in assertions | ||
| with LogCapture() as log: | ||
| print("Testing dn:", dn) |
Member
There was a problem hiding this comment.
Shouldn't generally be printing in tests. We only care about the output if something fails.
- removes printing in test - rewrites line using with context manager - changes variable name - passes cp as an argument to the fucntion - shortens long lines
Contributor
Author
Contributor
Author
|
updating to latest dev |
tofu-rocketry
requested changes
Sep 28, 2023
ssm/agents.py
Outdated
| else: | ||
| log.warning('DN in banned dns list is not in ' | ||
| 'the correct format: %s', line) | ||
| finally: |
Member
There was a problem hiding this comment.
Now we have a context manager for the file, we can get rid of the try...finally wrapper (and the `f=None') as the file will close as soon as the handler is exited (whether normally or by exception).
test/test_ssm.py
Outdated
|
|
||
| ssm._save_msg_to_queue(message_rejected, empaid) | ||
|
|
||
| print(str(log)) |
Member
There was a problem hiding this comment.
There's this and the print below that also need removing.
Member
|
testfixtures will need adding to requirements-test.txt so it's available in Travis. |
- this makes it available in Travis - used in class TestMsgToQueue
- removes remaining print statements to simplify logging output - adds teardown - also improves comments
- with the addition of a context manager for a file in an earlier commit, this wasn't needed
William-Brown5515
pushed a commit
to William-Brown5515/ssm
that referenced
this pull request
Nov 20, 2024
William-Brown5515
pushed a commit
to William-Brown5515/ssm
that referenced
this pull request
Nov 20, 2024
William-Brown5515
pushed a commit
to William-Brown5515/ssm
that referenced
this pull request
Nov 20, 2024
…torage-records [apel#238] Add storage record type for logger
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.






resolves #184