-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: feeds operations API function (#838)
- Loading branch information
1 parent
868662b
commit dc5700c
Showing
62 changed files
with
3,111 additions
and
61 deletions.
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
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
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
from starlette.datastructures import Headers | ||
|
||
from middleware.request_context import RequestContext, get_request_context, _request_context, is_user_email_restricted | ||
from middleware.request_context import RequestContext, get_request_context, _request_context | ||
|
||
|
||
class TestRequestContext(unittest.TestCase): | ||
|
@@ -54,45 +54,3 @@ def test_get_request_context(self): | |
request_context = RequestContext(MagicMock()) | ||
_request_context.set(request_context) | ||
self.assertEqual(request_context, get_request_context()) | ||
|
||
def test_is_user_email_restricted(self): | ||
self.assertTrue(is_user_email_restricted()) | ||
scope_instance = { | ||
"type": "http", | ||
"asgi": {"version": "3.0"}, | ||
"http_version": "1.1", | ||
"method": "GET", | ||
"headers": [ | ||
(b"host", b"localhost"), | ||
(b"x-forwarded-proto", b"https"), | ||
(b"x-forwarded-for", b"client, proxy1"), | ||
(b"server", b"server"), | ||
(b"user-agent", b"user-agent"), | ||
(b"x-goog-iap-jwt-assertion", b"jwt"), | ||
(b"x-cloud-trace-context", b"TRACE_ID/SPAN_ID;o=1"), | ||
(b"x-goog-authenticated-user-id", b"user_id"), | ||
(b"x-goog-authenticated-user-email", b"email"), | ||
], | ||
"path": "/", | ||
"raw_path": b"/", | ||
"query_string": b"", | ||
"client": ("127.0.0.1", 32767), | ||
"server": ("127.0.0.1", 80), | ||
} | ||
request_context = RequestContext(scope=scope_instance) | ||
_request_context.set(request_context) | ||
self.assertTrue(is_user_email_restricted()) | ||
scope_instance["headers"] = [ | ||
(b"host", b"localhost"), | ||
(b"x-forwarded-proto", b"https"), | ||
(b"x-forwarded-for", b"client, proxy1"), | ||
(b"server", b"server"), | ||
(b"user-agent", b"user-agent"), | ||
(b"x-goog-iap-jwt-assertion", b"jwt"), | ||
(b"x-cloud-trace-context", b"TRACE_ID/SPAN_ID;o=1"), | ||
(b"x-goog-authenticated-user-id", b"user_id"), | ||
(b"x-goog-authenticated-user-email", b"[email protected]"), | ||
] | ||
request_context = RequestContext(scope=scope_instance) | ||
_request_context.set(request_context) | ||
self.assertTrue(is_user_email_restricted()) |
Oops, something went wrong.