Exemplo n.º 1
0
def test_input_0():
    """
    Test with an empty input file, should simply log and exit with error code 1
    """

    # Setup
    helper.cleanup()

    file_path = process.TESTING_DIRECTORY + '/empty_file'
    assert(helper.run_processing_engine(file_path) == 1)

    # Teardown
    helper.cleanup()
Exemplo n.º 2
0
def test_input_5():
    """
    Test with a valid input file:
        - Single tweet
        - 2 companies (GM and Tesla)
        - Positive sentiment
        - History file: base
    """

    # Setup
    helper.cleanup()
    shutil.copyfile(process.TESTING_DIRECTORY + '/base_aliases', process.HISTORY_FILE)

    file_path = process.TESTING_DIRECTORY + '/test_input_5'
    assert (helper.run_processing_engine(file_path) == 0)

    # Teardown
    helper.cleanup()
Exemplo n.º 3
0
def test_input_4():
    """
    Test with a valid input file:
        - Single tweet
        - 2 companies (AMD and GM)
        - Negative sentiment
        - History file: base
    """

    # Setup
    helper.cleanup()
    shutil.copyfile(process.TESTING_DIRECTORY + '/test_history_3', process.HISTORY_FILE)

    file_path = process.TESTING_DIRECTORY + '/test_input_4'
    assert (helper.run_processing_engine(file_path) == 0)

    # Teardown
    helper.cleanup()
Exemplo n.º 4
0
def test_input_2():
    """
    Test with a valid input file:
        - Single tweet
        - Single company (United Airlines)
        - Negative sentiment
        - History file: base
    """

    # Setup
    helper.cleanup()
    shutil.copyfile(process.TESTING_DIRECTORY + '/base_aliases', process.HISTORY_FILE)

    file_path = process.TESTING_DIRECTORY + '/test_input_2'
    assert (helper.run_processing_engine(file_path) == 0)

    # Teardown
    helper.cleanup()
Exemplo n.º 5
0
def test_input_3():
    """
    Test with a valid input file:
        - 2 tweets, single company per tweet
        - Two companies (Tesla and GM)
        - Positive sentiment for Tesla
        - Negative sentiment for GM
        - History file: 3
    """

    # Setup
    helper.cleanup()
    shutil.copyfile(process.TESTING_DIRECTORY + '/base_aliases', process.HISTORY_FILE)

    file_path = process.TESTING_DIRECTORY + '/test_input_3'
    assert (helper.run_processing_engine(file_path) == 0)

    # Teardown
    helper.cleanup()