Esempio n. 1
0
def check_telescope(file_input=None, is_json=False):
    """Creates a machine object to process the 10 latest telescope posts"""
    if is_json:
        url_machine = url_class.urlAutomationMachine(file_input, is_json)
        url_machine.processTelescope()
    else:
        url_machine = url_class.urlAutomationMachine(file_input)
        url_machine.processTelescope()
Esempio n. 2
0
def check_url(file_input, is_json=False):
    """Creates a machine object to process a single URL"""
    if is_json:
        url_machine = url_class.urlAutomationMachine(file_input, is_json)
        url_machine.processUrl()
    else:
        url_machine = url_class.urlAutomationMachine(file_input)
        url_machine.processUrl()
Esempio n. 3
0
def check_file(file_input, is_json=False, ignore=None):
    """Creates a machine object to process a file of URLs"""
    if is_json:
        url_machine = url_class.urlAutomationMachine(file_input, is_json,
                                                     ignore)
        url_machine.processFile()
    else:
        url_machine = url_class.urlAutomationMachine(file_input, False, ignore)
        url_machine.processFile()
Esempio n. 4
0
def test_file_upload_is_not_file():
    test_url = urlAutomationMachine({})

    with pytest.raises(ValueError) as error_value:
        test_url.processFile()

    assert "Function requires a file to be inserted" in str(error_value)
Esempio n. 5
0
def test_file_upload_empty():
    test_url = urlAutomationMachine()

    with pytest.raises(AttributeError) as error_value:
        test_url.processFile()

    assert "A parameter is required" in str(error_value)
Esempio n. 6
0
def test_process_url_failed(example_urls):
    url = example_urls[1]
    test_url = urlAutomationMachine(url)

    test_url.processUrl()

    assert (test_url.getStatus()) == 404
Esempio n. 7
0
def test_url_unknown(example_urls):
    url = example_urls[2]

    test_url = urlAutomationMachine(url)

    test_url.processUrl()

    assert (test_url.getStatus()) == 403
Esempio n. 8
0
def test_url_is_not_correct():
    url = "htt://www.google.ca"

    test_url = urlAutomationMachine(url)

    assert (test_url.checkUrl()) == None