How to use the gabbi.case.HTTPTestCase function in gabbi

To help you get started, we’ve selected a few gabbi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cdent / gabbi / gabbi / suitemaker.py View on Github external
if prior_test:
            history = prior_test.history
        else:
            history = {}

        test_method_name = 'test_request'
        test_method = getattr(case.HTTPTestCase, test_method_name)

        @case.testcase.skipIf(self.host == '', 'No host configured')
        @functools.wraps(test_method)
        def do_test(*args, **kwargs):
            return test_method(*args, **kwargs)

        # Use metaclasses to build a class of the necessary type
        # and name with relevant arguments.
        klass = TestBuilder(test_name, (case.HTTPTestCase,),
                            {'test_data': test,
                             'test_directory': self.test_directory,
                             'fixtures': self.fixture_classes,
                             'inner_fixtures': self.inner_fixtures,
                             'http': http_class,
                             'host': self.host,
                             'intercept': self.intercept,
                             'content_handlers': self.content_handlers,
                             'response_handlers': self.response_handlers,
                             'port': self.port,
                             'prefix': self.prefix,
                             'prior': prior_test,
                             'history': history,
                             test_method_name: do_test,
                             })
        # We've been asked to, make this test class think it comes
github cdent / gabbi / gabbi / case.py View on Github external
def run(self, result=None):
        """Store the current result handler on this test."""
        self.result = result
        super(HTTPTestCase, self).run(result)
github cdent / gabbi / gabbi / case.py View on Github external
def _simple_replacer_regex(key):
        """Compose a regular expression for simple variable replacement."""
        case = HTTPTestCase._history_regex
        return r"%s\$%s" % (case, key)