Example #1
0
    def _assert_expected_call_order(self, model, params):
        if not self._queue:
            raise StubResponseError(
                operation_name=model.name,
                reason=('Unexpected API Call: called with parameters:\n%s' %
                        pformat(params)))

        name = self._queue[0]['operation_name']
        if name != model.name:
            raise StubResponseError(
                operation_name=model.name,
                reason='Operation mismatch: found response for %s.' % name)
Example #2
0
 def _assert_expected_params(self, model, params, **kwargs):
     self._assert_expected_call_order(model, params)
     expected_params = self._queue[0]['expected_params']
     if expected_params is not None and params != expected_params:
         raise StubResponseError(
             operation_name=model.name,
             reason='Expected parameters: %s, but received: %s' % (
                 params, expected_params))
Example #3
0
    def _assert_expected_call_order(self, model, params):
        if not self._queue:
            raise UnStubbedResponseError(
                operation_name=model.name,
                reason=
                ('Unexpected API Call: A call was made but no additional calls expected.'
                 'Either the API Call was not stubbed or it was called multiple times.'
                 ))

        name = self._queue[0]['operation_name']
        if name != model.name:
            raise StubResponseError(
                operation_name=model.name,
                reason='Operation mismatch: found response for %s.' % name)