Skip to content

Commit c8a92de

Browse files
author
Philipp Schrader
committed
Fix a bug in the JS model builder tests
The test intends to make sure that the TestSuite class produces the expected behaviour. However, the test does not account for potentially compressed strings that are produced inside the TestSuite class. This patch compresses those strings to match what TestSuite would do.
1 parent 74deb51 commit c8a92de

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)