forked from mitmproxy/mitmproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b31f5c
commit bd8a869
Showing
4 changed files
with
31 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,21 @@ | ||
# TODO: write tests | ||
from mitmproxy.contentviews import wbxml | ||
from mitmproxy.test import tutils | ||
from . import full_eval | ||
|
||
data = tutils.test_data.push("mitmproxy/contentviews/test_wbxml_data/") | ||
|
||
|
||
def test_wbxml(): | ||
v = full_eval(wbxml.ViewWBXML()) | ||
|
||
assert v(b'\x03\x01\x6A\x00') == ('WBXML', [[('text', '<?xml version="1.0" ?>')]]) | ||
assert v(b'foo') is None | ||
|
||
path = data.path("data.wbxml") # File taken from https://github.com/davidpshaw/PyWBXMLDecoder/tree/master/wbxml_samples | ||
with open(path, 'rb') as f: | ||
input = f.read() | ||
with open("-formatted.".join(path.rsplit(".", 1))) as f: | ||
expected = f.read() | ||
|
||
p = wbxml.ASCommandResponse.ASCommandResponse(input) | ||
assert p.xmlString == expected |
10 changes: 10 additions & 0 deletions
10
test/mitmproxy/contentviews/test_wbxml_data/data-formatted.wbxml
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,10 @@ | ||
<?xml version="1.0" ?> | ||
<Sync> | ||
<Collections> | ||
<Collection> | ||
<SyncKey>1509029063</SyncKey> | ||
<CollectionId>7</CollectionId> | ||
<Status>1</Status> | ||
</Collection> | ||
</Collections> | ||
</Sync> |
Binary file not shown.