2014-04-28 12:29:41 +03:00
|
|
|
"""Test data"""
|
2020-09-28 12:16:57 +02:00
|
|
|
from pathlib import Path
|
2014-04-24 16:17:04 +03:00
|
|
|
|
2021-08-05 20:58:43 +02:00
|
|
|
from httpie.constants import UTF8
|
|
|
|
|
2014-04-24 16:17:04 +03:00
|
|
|
|
|
|
|
def patharg(path):
|
2014-04-27 00:04:45 +03:00
|
|
|
"""
|
|
|
|
Back slashes need to be escaped in ITEM args,
|
|
|
|
even in Windows paths.
|
|
|
|
|
|
|
|
"""
|
2020-09-28 12:16:57 +02:00
|
|
|
return str(path).replace('\\', '\\\\\\')
|
2014-04-24 16:17:04 +03:00
|
|
|
|
|
|
|
|
2020-09-28 12:16:57 +02:00
|
|
|
FIXTURES_ROOT = Path(__file__).parent
|
|
|
|
FILE_PATH = FIXTURES_ROOT / 'test.txt'
|
|
|
|
JSON_FILE_PATH = FIXTURES_ROOT / 'test.json'
|
|
|
|
BIN_FILE_PATH = FIXTURES_ROOT / 'test.bin'
|
2021-08-31 22:49:53 +02:00
|
|
|
XML_FILES_PATH = FIXTURES_ROOT / 'xmldata'
|
|
|
|
XML_FILES_VALID = list((XML_FILES_PATH / 'valid').glob('*_raw.xml'))
|
|
|
|
XML_FILES_INVALID = list((XML_FILES_PATH / 'invalid').glob('*.xml'))
|
2014-04-24 16:17:04 +03:00
|
|
|
|
|
|
|
FILE_PATH_ARG = patharg(FILE_PATH)
|
|
|
|
BIN_FILE_PATH_ARG = patharg(BIN_FILE_PATH)
|
|
|
|
JSON_FILE_PATH_ARG = patharg(JSON_FILE_PATH)
|
|
|
|
|
2020-09-28 12:16:57 +02:00
|
|
|
# Strip because we don't want new lines in the data so that we can
|
|
|
|
# easily count occurrences also when embedded in JSON (where the new
|
|
|
|
# line would be escaped).
|
2021-08-05 20:58:43 +02:00
|
|
|
FILE_CONTENT = FILE_PATH.read_text(encoding=UTF8).strip()
|
2014-04-26 19:41:28 +03:00
|
|
|
|
2014-04-26 20:47:14 +03:00
|
|
|
|
2021-08-05 20:58:43 +02:00
|
|
|
JSON_FILE_CONTENT = JSON_FILE_PATH.read_text(encoding=UTF8)
|
2020-09-28 12:16:57 +02:00
|
|
|
BIN_FILE_CONTENT = BIN_FILE_PATH.read_bytes()
|
2014-04-26 20:47:14 +03:00
|
|
|
UNICODE = FILE_CONTENT
|