Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Customize http header * add simple unit tests * string instead of integer with leading zero * doc: clarity spec vs config files * raise when an invalid type is given (#3) * raise when an invalid type is given * fix syntax * fix install test. update version
- Loading branch information
1 parent
0aab61a
commit 9665196
Showing
11 changed files
with
135 additions
and
21 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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from tap_rest_api.helper import get_http_headers, USER_AGENT | ||
|
||
|
||
DEFAULT_HEADERS = {"User-Agent": USER_AGENT, | ||
"Content-type": "application/json"} | ||
|
||
|
||
def test_default(): | ||
h = get_http_headers() | ||
assert h == DEFAULT_HEADERS | ||
|
||
|
||
def test_agent_overwrite(): | ||
ua = ("Mozilla/5.1 (Macintosh; scitylana.singer.io) " + | ||
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 " + | ||
"Safari/537.36 ") | ||
config = {"http_headers": {"User-Agent": ua, | ||
"Conetnt-type": "application/json", | ||
"Bearer": "xxxxyyyy"}} | ||
|
||
h = get_http_headers(config) | ||
|
||
assert h == config["http_headers"] |