How to use the apiritif.__init__.Event function in apiritif

To help you get started, we’ve selected a few apiritif 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 Blazemeter / taurus / apiritif / __init__.py View on Github external
class Request(Event):
    def __init__(self, method, address, request, response, session):
        super(Request, self).__init__()
        self.method = method
        self.address = address
        self.request = request
        self.response = response
        self.session = session

    def __repr__(self):
        return "Request(method=%r, address=%r)" % (self.method, self.address)


class TransactionStarted(Event):
    def __init__(self, transaction_name):
        super(TransactionStarted, self).__init__()
        self.transaction_name = transaction_name

    def __repr__(self):
        return "TransactionStarted(transaction_name=%r)" % self.transaction_name


class TransactionEnded(Event):
    def __init__(self, transaction_name):
        super(TransactionEnded, self).__init__()
        self.transaction_name = transaction_name

    def __repr__(self):
        return "TransactionEnded(transaction_name=%r)" % self.transaction_name
github Blazemeter / taurus / apiritif / __init__.py View on Github external
self.session = session

    def __repr__(self):
        return "Request(method=%r, address=%r)" % (self.method, self.address)


class TransactionStarted(Event):
    def __init__(self, transaction_name):
        super(TransactionStarted, self).__init__()
        self.transaction_name = transaction_name

    def __repr__(self):
        return "TransactionStarted(transaction_name=%r)" % self.transaction_name


class TransactionEnded(Event):
    def __init__(self, transaction_name):
        super(TransactionEnded, self).__init__()
        self.transaction_name = transaction_name

    def __repr__(self):
        return "TransactionEnded(transaction_name=%r)" % self.transaction_name


class Assertion(Event):
    def __init__(self, name, response):
        super(Assertion, self).__init__()
        self.name = name
        self.response = response

    def __repr__(self):
        return "Assertion(name=%r)" % self.name
github Blazemeter / taurus / apiritif / __init__.py View on Github external
@contextmanager
def transaction(name):
    recorder.record_transaction_start(name)
    try:
        yield
    finally:
        recorder.record_transaction_end(name)


class Event(object):
    def __init__(self):
        self.timestamp = time.time()


class Request(Event):
    def __init__(self, method, address, request, response, session):
        super(Request, self).__init__()
        self.method = method
        self.address = address
        self.request = request
        self.response = response
        self.session = session

    def __repr__(self):
        return "Request(method=%r, address=%r)" % (self.method, self.address)


class TransactionStarted(Event):
    def __init__(self, transaction_name):
        super(TransactionStarted, self).__init__()
        self.transaction_name = transaction_name
github Blazemeter / taurus / apiritif / __init__.py View on Github external
def __repr__(self):
        return "TransactionEnded(transaction_name=%r)" % self.transaction_name


class Assertion(Event):
    def __init__(self, name, response):
        super(Assertion, self).__init__()
        self.name = name
        self.response = response

    def __repr__(self):
        return "Assertion(name=%r)" % self.name


class AssertionFailure(Event):
    def __init__(self, assertion_name, response, failure_message):
        super(AssertionFailure, self).__init__()
        self.name = assertion_name
        self.response = response
        self.failure_message = failure_message

    def __repr__(self):
        return "Assertion(name=%r, failure_message=%r)" % (self.name, self.failure_message)


# TODO: thread-safe version?
class _EventRecorder(object):
    def __init__(self):
        self._recording = OrderedDict()  # test_case: str -> [Event]
        self.log = log.getChild('recorder')
github Blazemeter / taurus / apiritif / __init__.py View on Github external
self.transaction_name = transaction_name

    def __repr__(self):
        return "TransactionStarted(transaction_name=%r)" % self.transaction_name


class TransactionEnded(Event):
    def __init__(self, transaction_name):
        super(TransactionEnded, self).__init__()
        self.transaction_name = transaction_name

    def __repr__(self):
        return "TransactionEnded(transaction_name=%r)" % self.transaction_name


class Assertion(Event):
    def __init__(self, name, response):
        super(Assertion, self).__init__()
        self.name = name
        self.response = response

    def __repr__(self):
        return "Assertion(name=%r)" % self.name


class AssertionFailure(Event):
    def __init__(self, assertion_name, response, failure_message):
        super(AssertionFailure, self).__init__()
        self.name = assertion_name
        self.response = response
        self.failure_message = failure_message