How to use the pythonping.executor.ResponseList function in pythonping

To help you get started, we’ve selected a few pythonping 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 alessandromaggio / pythonping / test / test_executor.py View on Github external
def test_success_all_success(self):
        """Verify success is calculated correctly if all responses are successful"""
        rs = executor.ResponseList([
            SuccessfulResponseMock(None, 1),
            SuccessfulResponseMock(None, 1),
            SuccessfulResponseMock(None, 1),
            SuccessfulResponseMock(None, 1)
        ])
        self.assertTrue(
            rs.success(executor.SuccessOn.One),
            'Unable to calculate success on one correctly with all responses successful'
        )
        self.assertTrue(
            rs.success(executor.SuccessOn.Most),
            'Unable to calculate success on most with all responses successful'
        )
        self.assertTrue(
            rs.success(executor.SuccessOn.All),
            'Unable to calculate success on all with all responses successful'
github alessandromaggio / pythonping / test / test_executor.py View on Github external
def test_success_one_success(self):
        """Verify success is calculated correctly if one response is successful"""
        rs = executor.ResponseList([
            SuccessfulResponseMock(None, 1),
            FailingResponseMock(None, 1),
            FailingResponseMock(None, 1),
            FailingResponseMock(None, 1)
        ])
        self.assertTrue(
            rs.success(executor.SuccessOn.One),
            'Unable to calculate success on one correctly with one response successful'
        )
        self.assertFalse(
            rs.success(executor.SuccessOn.Most),
            'Unable to calculate success on most with one response successful'
        )
        self.assertFalse(
            rs.success(executor.SuccessOn.All),
            'Unable to calculate success on all with one response successful'
github alessandromaggio / pythonping / test / test_executor.py View on Github external
def test_success_half_success(self):
        """Verify success is calculated correctly if half responses are successful"""
        rs = executor.ResponseList([
            SuccessfulResponseMock(None, 1),
            SuccessfulResponseMock(None, 1),
            FailingResponseMock(None, 1),
            FailingResponseMock(None, 1)
        ])
        self.assertTrue(
            rs.success(executor.SuccessOn.One),
            'Unable to calculate success on one correctly with half responses successful'
        )
        self.assertFalse(
            rs.success(executor.SuccessOn.Most),
            'Unable to calculate success on most with half responses successful'
        )
        self.assertFalse(
            rs.success(executor.SuccessOn.All),
            'Unable to calculate success on all with half responses successful'
github alessandromaggio / pythonping / test / test_executor.py View on Github external
def test_success_most_success(self):
        """Verify success is calculated correctly if most responses are successful"""
        rs = executor.ResponseList([
            SuccessfulResponseMock(None, 1),
            SuccessfulResponseMock(None, 1),
            SuccessfulResponseMock(None, 1),
            FailingResponseMock(None, 1)
        ])
        self.assertTrue(
            rs.success(executor.SuccessOn.One),
            'Unable to calculate success on one correctly with most responses successful'
        )
        self.assertTrue(
            rs.success(executor.SuccessOn.Most),
            'Unable to calculate success on most with most responses successful'
        )
        self.assertFalse(
            rs.success(executor.SuccessOn.All),
            'Unable to calculate success on all with most responses successful'
github alessandromaggio / pythonping / pythonping / executor.py View on Github external
:param payload_provider: An iterable list of payloads to send
        :type payload_provider: PayloadProvider
        :param timeout: Timeout that will apply to all ping messages, in seconds
        :type timeout: int
        :param socket_options: Options to specify for the network.Socket
        :type socket_options: tuple
        :param seed_id: The first ICMP packet ID to use
        :type seed_id: Union[None, int]
        :param verbose: Flag to enable verbose mode, defaults to False
        :type verbose: bool
        :param output: File where to write verbose output, defaults to stdout
        :type output: file"""
        self.socket = network.Socket(target, 'icmp', source=None, options=socket_options)
        self.provider = payload_provider
        self.timeout = timeout
        self.responses = ResponseList(verbose=verbose, output=output)
        self.seed_id = seed_id
        if self.seed_id is None:
            self.seed_id = os.getpid() & 0xFFFF