-
Notifications
You must be signed in to change notification settings - Fork 2
#47 empty headers in admin #48
base: develop
Are you sure you want to change the base?
Conversation
Merge develop from uma-tech parrot
Codecov Report
@@ Coverage Diff @@
## develop #48 +/- ##
===========================================
+ Coverage 98.31% 98.34% +0.02%
===========================================
Files 5 5
Lines 119 121 +2
Branches 4 5 +1
===========================================
+ Hits 117 119 +2
Misses 2 2
Continue to review full report at Codecov.
|
http_stubs/views.py
Outdated
@@ -64,3 +64,14 @@ def dispatch(self, request: HttpRequest, *args, **kwargs) -> HttpResponse: | |||
for header_name, header_value in stub.resp_headers.items(): | |||
response[header_name] = header_value | |||
return response | |||
|
|||
def remove_empty_headers(self, headers: Dict) -> Dict: |
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.
Maybe we should strive to use more accurate type annotations:
Dict[str, str] -> Dict[str, str]
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.
Changed. Thanks!
http_stubs/tests/tests.py
Outdated
:param client: http client fixture | ||
""" | ||
http_stub_factory(method=HTTPMethod.GET.name) | ||
client.get('/default_path/') |
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.
Could you please move this string ('/default_path/'
) to a separate variable and use wherever it should be used
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.
Changed. Thanks!
http_stubs/tests/tests.py
Outdated
http_stub_factory(method=HTTPMethod.GET.name) | ||
client.get('/default_path/') | ||
log = LogEntry.objects.last() | ||
assert log.headers == {} # noqa:WPS520 |
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.
assert log.headers == {} # noqa:WPS520 | |
assert bool(log.headers) is False |
I think, it would be better this way
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.
Changed. Thanks!
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
http_stub_factory(method=HTTPMethod.GET.name) | ||
client.get(self.path) | ||
log = LogEntry.objects.last() | ||
assert bool(log.headers) is False |
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.
Nitpicking, but:
assert bool(log.headers) is False | |
assert not bool(log.headers) |
@@ -64,3 +64,14 @@ def dispatch(self, request: HttpRequest, *args, **kwargs) -> HttpResponse: | |||
for header_name, header_value in stub.resp_headers.items(): | |||
response[header_name] = header_value | |||
return response | |||
|
|||
def remove_empty_headers(self, headers: Dict[str, str]) -> Dict[str, str]: |
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.
Just asking: can't be empty headers significant? E.g. indicate there's something wrong on the sending side?
closes #47