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

PR-2930 add tests #169

Merged
merged 14 commits into from
Feb 4, 2022
Merged

PR-2930 add tests #169

merged 14 commits into from
Feb 4, 2022

Conversation

reweeden
Copy link
Contributor

@reweeden reweeden commented Jan 22, 2022

Closes #162
Closes #164

I rewrote the JSON logger to always output valid JSON. It would previously only output valid JSON if you passed in a json-like object into the log call such as log.info({"foo": "bar"}). I suspect that the quote replacement was there because when python print's dictionaries/strings it prints them in a way that looks very similar to JSON except that it uses single quotes (and of course there is no conversion of dictionary keys to strings which is required by the JSON spec) and this was being used as a budget JSON encoder.

I changed some of the log censoring, but it might be better to just skip testing that for now and come back to it when we figure out how we want to handle it properly #163.

rain_api_core/aws_util.py Outdated Show resolved Hide resolved
rain_api_core/general_util.py Outdated Show resolved Hide resolved
rain_api_core/urs_util.py Outdated Show resolved Hide resolved
rain_api_core/urs_util.py Show resolved Hide resolved
rain_api_core/urs_util.py Outdated Show resolved Hide resolved
rain_api_core/view_util.py Outdated Show resolved Hide resolved
rain_api_core/view_util.py Outdated Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
@reweeden reweeden force-pushed the rew/pr-2930-add-tests branch from e067ba8 to 70940c1 Compare January 25, 2022 19:15
rain_api_core/aws_util.py Outdated Show resolved Hide resolved
rain_api_core/urs_util.py Outdated Show resolved Hide resolved
rain_api_core/urs_util.py Outdated Show resolved Hide resolved
rain_api_core/general_util.py Outdated Show resolved Hide resolved
},
{
"regex": r"(EDL-[A-Za-z0-9]+)[A-Za-z0-9]{40}([A-Za-z0-9]{10})",
"replace": "\\g<1>XXX<EDLTOKEN>XXX\\g<2>",
Copy link
Collaborator

Choose a reason for hiding this comment

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

@bbuechler Did you ever need to look for a particular credential in the logs?

@reweeden reweeden force-pushed the rew/pr-2930-add-tests branch from c95ece9 to 3c59d6a Compare January 27, 2022 01:49
rain_api_core/logging.py Outdated Show resolved Hide resolved
@reweeden reweeden force-pushed the rew/pr-2930-add-tests branch 3 times, most recently from 6f2edc2 to 2bf4b6a Compare January 27, 2022 23:02
@reweeden reweeden requested review from benbart and Jlrine2 January 28, 2022 01:39
@reweeden reweeden force-pushed the rew/pr-2930-add-tests branch 3 times, most recently from 61e8535 to eb5a3d2 Compare January 28, 2022 19:23
@@ -0,0 +1,261 @@
import json
import logging
Copy link
Collaborator

@benbart benbart Jan 31, 2022

Choose a reason for hiding this comment

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

Can we rename logging.py to something that doesn't potentially conflict with the standard 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.

What would you suggest? I purposefully used the same name so that it would be clear that these are extensions to the standard logging module, and it's already in the rain_api_core namespace so there shouldn't be any conflicts.

rain_api_core/logging.py Outdated Show resolved Hide resolved
@reweeden reweeden force-pushed the rew/pr-2930-add-tests branch from eb5a3d2 to c7657e9 Compare February 1, 2022 18:15
@reweeden reweeden force-pushed the rew/pr-2930-add-tests branch from 864b2d2 to 3e4fd27 Compare February 1, 2022 19:03
Comment on lines +1 to +6
boto3==1.20.29
hypothesis==6.36.0
moto==2.3.1
pytest-cov==3.0.0
pytest-mock==3.6.1
pytest==6.2.5
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if we need to be pinning the dev dependencies or not

@mckadesorensen mckadesorensen merged commit c6b97ab into master Feb 4, 2022
@reweeden reweeden deleted the rew/pr-2930-add-tests branch February 14, 2022 17:12
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.

Evaluate quote replacement in reformat_for_json() Refactor cookie handling using some other package
4 participants