feat: load jina auth token from environment#368
Conversation
Codecov Report
@@ Coverage Diff @@
## main #368 +/- ##
===========================================
+ Coverage 56.98% 84.51% +27.52%
===========================================
Files 134 134
Lines 6324 6368 +44
===========================================
+ Hits 3604 5382 +1778
+ Misses 2720 986 -1734
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
| _get_auth_token.cache_clear() | ||
|
|
||
| token = 'test-auth-token' | ||
| os.environ['JINA_AUTH_TOKEN'] = token |
There was a problem hiding this comment.
this should be handled with a fixture to make sure this does not pollute other tests in case of Exceptions
There was a problem hiding this comment.
I unset the env var in the same tests
There was a problem hiding this comment.
yes, but what if there is an Exception in the middle, then this part of the code is not executed
| @pytest.mark.parametrize( | ||
| 'set_env_vars', [{'JINA_AUTH_TOKEN': 'test-auth-token'}], indirect=True | ||
| ) | ||
| def test_api_authorization_header_from_env(mocker, monkeypatch, set_env_vars): |
There was a problem hiding this comment.
let's just add one last test that asserts the priority in case both are set
Goals:
da.pushandDocumentArray.pull. Uses keyJINA_AUTH_TOKEN