summaryrefslogtreecommitdiffstats
path: root/test/vpp_papi_provider.py
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2018-11-08 11:52:04 +0100
committerDamjan Marion <dmarion@me.com>2018-11-08 12:47:44 +0000
commit7d6afb3c94613f6537f20087674042e8bf440a89 (patch)
tree0fb0c566d1c6c2ab710ed3df847cd5c095deaf50 /test/vpp_papi_provider.py
parent03a3e76ff8859cff7ce9f3ae2f3030a1f90aeeb6 (diff)
make test: bfd refactor
Change-Id: I14a126521d8c8138904c8b9da05d4144c72c51a5 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test/vpp_papi_provider.py')
-rw-r--r--test/vpp_papi_provider.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 9f7968bbbb7..82990bcf280 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -78,14 +78,23 @@ class VppPapiProvider(object):
def __enter__(self):
return self
- def expect_negative_api_retval(self):
- """ Expect API failure """
+ def assert_negative_api_retval(self):
+ """ Expect API failure - used with with, e.g.:
+ with self.vapi.assert_negative_api_retval():
+ self.vapi.<api call expected to fail>
+ """
self._expect_stack.append(self._expect_api_retval)
self._expect_api_retval = self._negative
return self
- def expect_zero_api_retval(self):
- """ Expect API success """
+ def assert_zero_api_retval(self):
+ """ Expect API success - used with with, e.g.:
+ with self.vapi.assert_negative_api_retval():
+ self.vapi.<api call expected to succeed>
+
+ note: this is useful only inside another with block
+ as success is the default expected value
+ """
self._expect_stack.append(self._expect_api_retval)
self._expect_api_retval = self._zero
return self