File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
test_elasticsearch/test_server Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ def run_code(self, test):
40
40
41
41
def run_do (self , action ):
42
42
""" Perform an api call with given parameters. """
43
+
44
+ catch = action .pop ('catch' , None )
43
45
self .assertEquals (1 , len (action ))
44
46
45
47
method , args = list (action .items ())[0 ]
@@ -56,12 +58,23 @@ def run_do(self, action):
56
58
if k in args :
57
59
args [PARAMS_RENAMES [k ]] = args .pop (k )
58
60
59
- self .last_response = api (** args )
61
+ try :
62
+ self .last_response = api (** args )
63
+ except :
64
+ if not catch :
65
+ raise
66
+ self .run_catch (catch )
67
+ else :
68
+ if catch :
69
+ raise AssertionError ('Failed to catch %r in %r.' % (catch , self .last_response ))
70
+
71
+ def run_catch (self , catch ):
72
+ pass
60
73
61
74
def run_length (self , action ):
62
75
self .run_is (action , len )
63
76
64
- def run_is (self , action , transform = None ):
77
+ def run_match (self , action , transform = None ):
65
78
""" Match part of last response to test data. """
66
79
67
80
# matching part of the reponse dict
You can’t perform that action at this time.
0 commit comments