def __init__(self, name="Unnamed Test", pre_hook=None, test_params=None, post_hook=None, protocols=(HTTP, )): super(HTTPTest, self).__init__(name, pre_hook, test_params, post_hook, protocols) with self: # if any exception occurs, self.__exit__ will be immediately called self.server_setup() self.do_test() print_green('Test Passed.')
def begin(self): if not self.ready: # this is to maintain compatibility with scripts that # don't call setup() self.setup() with self: # If any exception occurs, self.__exit__ will be immediately called. # We must call the parent method in the end in order to verify # whether the tests succeeded or not. if self.ready: self.do_test() print_green("Test Passed.") else: self.tests_passed = False super(HTTPTest, self).begin()
def __init__(self, name="Unnamed Test", pre_hook=None, test_params=None, post_hook=None, protocols=(HTTP,)): super(HTTPTest, self).__init__(name, pre_hook, test_params, post_hook, protocols) with self: # if any exception occurs, self.__exit__ will be immediately called self.server_setup() self.do_test() print_green('Test Passed.')