tests/test_webtracker.py
def mock_requests_get(url, timeout):
        """
        A mock request get method which returns different response for different URLs.
        Basically it covers all test paths.
        Among the return,
        https://aiven.io --> 200 (ok case)
        https://contentmatched.com --> 200 (Page content matched, ok case)
        https://contentdoesntmatch.com --> 200 (Page content not expected)
        https://non200status.com --> 403 (non 200 case)
        https://www.sslfailure.com --->  Exception requests.exceptions.SSLError
        https://timeout.com --> timeout error (Exception requests.exceptions.ConnectTimeout)
        https://anyotherexception.com --> Any other exception

        :param url: request url
        :param timeout: timeout in seconds
        :return:
        """
        if url in ['https://aiven.io', 'https://contentdoesntmatch.com', 'https://contentmatched.com']:
            return MockRequestResult(200)
        elif url == 'https://non200status.com':
            return MockRequestResult(403)
        elif url == 'https://www.sslfailure.com':
            raise requests.exceptions.SSLError()
        elif url == 'https://timeout.com':
            raise requests.exceptions.ConnectTimeout()
        elif url == 'https://anyotherexception.com':
            raise Exception('Any Exception')

        A mock request get method which returns different response for different URLs.
        Basically it covers all test paths.
        Among the return,
        https://aiven.io --> 200 (ok case)
        https://contentmatched.com --> 200 (Page content matched, ok case)
        https://contentdoesntmatch.com --> 200 (Page content not expected)
        https://non200status.com --> 403 (non 200 case)
        https://www.sslfailure.com --->  Exception requests.exceptions.SSLError
        https://timeout.com --> timeout error (Exception requests.exceptions.ConnectTimeout)
        https://anyotherexception.com --> Any other exception

        :param url: request url
        :param timeout: timeout in seconds
        :return:
        
A mock request get method which returns different response for different URLs.
Basically it covers all test paths.
A mock request get method which returns different response for different URLs . Basically it covers all test paths .
def mock_requests_get(url, timeout):
        if url in ['https://aiven.io', 'https://contentdoesntmatch.com', 'https://contentmatched.com']:
            return MockRequestResult(200)
        elif url == 'https://non200status.com':
            return MockRequestResult(403)
        elif url == 'https://www.sslfailure.com':
            raise requests.exceptions.SSLError()
        elif url == 'https://timeout.com':
            raise requests.exceptions.ConnectTimeout()
        elif url == 'https://anyotherexception.com':
            raise Exception('Any Exception')
def mock_requests_get ( url , timeout ) : if url in [ 'https://aiven.io' , 'https://contentdoesntmatch.com' , 'https://contentmatched.com' ] : return MockRequestResult ( 200 ) elif url == 'https://non200status.com' : return MockRequestResult ( 403 ) elif url == 'https://www.sslfailure.com' : raise requests . exceptions . SSLError ( ) elif url == 'https://timeout.com' : raise requests . exceptions . ConnectTimeout ( ) elif url == 'https://anyotherexception.com' : raise Exception ( 'Any Exception' )
A mock request get method which returns different response for different URLs.
A mock request get method which returns different response for different URLs .
"""
        A mock request get method which returns different response for different URLs.
        Basically it covers all test paths.
        Among the return,
        https://aiven.io --> 200 (ok case)
        https://contentmatched.com --> 200 (Page content matched, ok case)
        https://contentdoesntmatch.com --> 200 (Page content not expected)
        https://non200status.com --> 403 (non 200 case)
        https://www.sslfailure.com --->  Exception requests.exceptions.SSLError
        https://timeout.com --> timeout error (Exception requests.exceptions.ConnectTimeout)
        https://anyotherexception.com --> Any other exception

        :param url: request url
        :param timeout: timeout in seconds
        :return:
        """
None
url
None
timeout
timeout in seconds
timeout in seconds