-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change default User-Agent from Mozilla/5 to python-caldav/$version
Resolves #391
- Loading branch information
Showing
3 changed files
with
18 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,6 +276,7 @@ def testRequestNonAscii(self, mocked): | |
def testRequestCustomHeaders(self, mocked): | ||
""" | ||
ref https://github.com/python-caldav/caldav/issues/285 | ||
also ref https://github.com/python-caldav/caldav/issues/385 | ||
""" | ||
mocked().status_code = 200 | ||
mocked().headers = {} | ||
|
@@ -289,6 +290,20 @@ def testRequestCustomHeaders(self, mocked): | |
## User-Agent would be overwritten by some boring default in earlier versions | ||
assert client.headers["User-Agent"] == "MyCaldavApp" | ||
|
||
@mock.patch("caldav.davclient.requests.Session.request") | ||
def testRequestUserAgent(self, mocked): | ||
""" | ||
ref https://github.com/python-caldav/caldav/issues/391 | ||
""" | ||
mocked().status_code = 200 | ||
mocked().headers = {} | ||
cal_url = "http://me:[email protected]øøh.example:80/" | ||
client = DAVClient( | ||
url=cal_url, | ||
) | ||
assert client.headers["Content-Type"] == "text/xml" | ||
assert client.headers["User-Agent"].startswith("python-caldav/") | ||
|
||
@mock.patch("caldav.davclient.requests.Session.request") | ||
def testEmptyXMLNoContentLength(self, mocked): | ||
""" | ||
|