Skip to content

Commit c0c7038

Browse files
committed
Merge pull request robotframework#2329 from philsc/master
Handle possible compressed text in JS model builder tests
2 parents 667dfb9 + c8a92de commit c0c7038

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

utest/reporting/test_jsmodelbuilders.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import base64
12
import unittest
3+
import zlib
24
from os.path import abspath, basename, dirname, join
35

46
from robot.utils.asserts import assert_equal, assert_true
7+
from robot.utils.platform import PY2
58
from robot.result import Message, Keyword, TestCase, TestSuite
69
from robot.result.executionerrors import ExecutionErrors
710
from robot.model import Statistics
@@ -17,9 +20,17 @@
1720
CURDIR = dirname(abspath(__file__))
1821

1922

23+
def decode_string(string):
24+
string = string if PY2 else string.encode('ASCII')
25+
return zlib.decompress(base64.b64decode(string)).decode('UTF-8')
26+
27+
2028
def remap(model, strings):
2129
if isinstance(model, StringIndex):
22-
return strings[model][1:]
30+
if strings[model].startswith('*'):
31+
# Strip the asterisk from a raw string.
32+
return strings[model][1:]
33+
return decode_string(strings[model])
2334
elif isinstance(model, (int, long, type(None))):
2435
return model
2536
elif isinstance(model, tuple):

0 commit comments

Comments
 (0)