2727}
2828
2929# test features we have implemented
30- IMPLEMENTED_FEATURES = ()
30+ IMPLEMENTED_FEATURES = ('regex' )
3131
3232class InvalidActionType (Exception ):
3333 pass
@@ -46,11 +46,15 @@ def _resolve(self, value):
4646 value = value [1 :]
4747 self .assertIn (value , self ._state )
4848 value = self ._state [value ]
49+ if isinstance (value , (type (u'' ), type ('' ))):
50+ value = value .strip ()
4951 return value
5052
5153 def _lookup (self , path ):
5254 # fetch the possibly nested value from last_response
5355 value = self .last_response
56+ if path == '$body' :
57+ return value
5458 path = path .replace (r'\.' , '\1 ' )
5559 for step in path .split ('.' ):
5660 if not step :
@@ -167,7 +171,12 @@ def run_match(self, action):
167171 for path , expected in action .items ():
168172 value = self ._lookup (path )
169173 expected = self ._resolve (expected )
170- self .assertEquals (expected , value )
174+
175+ if expected .startswith ('/' ) and expected .endswith ('/' ):
176+ expected = re .compile (expected [1 :- 1 ], re .VERBOSE )
177+ self .assertTrue (expected .search (value ))
178+ else :
179+ self .assertEquals (expected , value )
171180
172181
173182def construct_case (filename , name ):
0 commit comments