コード例 #1
0
ファイル: test_app.py プロジェクト: zanon005/MyPytestApp
def test_invalid_user_input_for_config_cost_km(monkeypatch, load_test_data):
    # Setup
    # monkeypatch the "input" function, so that it returns  -1.
    # This simulates the user entering  -1  in the terminal:
    monkeypatch.setattr('builtins.input', lambda _: -1)
    my_app = app.App(load_test_data)

    # Exercise
    my_app.config_cost_km() # Consume input from monkeypatch

    # Verify
    #assert that the invalid user input was not stored  in the class
    assert my_app.cost_per_km == None
コード例 #2
0
ファイル: test_app.py プロジェクト: zanon005/MyPytestApp
def test_valid_user_input_for_config_cost_km(monkeypatch, load_test_data):
    # Setup
    # monkeypatch the "input" function, so that it returns  10.
    # This simulates the user entering  10  in the terminal:
    monkeypatch.setattr('builtins.input', lambda _: 10)
    desired = 10 #desired output for the actual output
    my_app = app.App(load_test_data)

    # Exercise
    #sets the value of 'cost_per_km' in app class to the monkeypatch value of 10
    my_app.config_cost_km() # Consume input from monkeypatch
    actual = my_app.cost_per_km

    # Verify
    #assert that the valid user input was stored in the class
    assert actual == desired
コード例 #3
0
ファイル: test_app.py プロジェクト: zanon005/MyPytestApp
def test_dist_CityA_CityB(load_test_data):
    # Setup
    my_app = app.App(load_test_data)
    city_a = "ARACAJU"
    city_b = "BELEM"
    desired = 2079

    # Exercise
    actual = my_app.dist_CityA_CityB(city_a, city_b)

    # Verify
    assert actual == desired

# def test_consult_segment(monkeypatch, load_test_data):
#     # Setup
#     # monkeypatch the "input" function, so that it returns  desired answers.
#     # This simulates the user entering "ARACAJU" and "BELEM" in the terminal, one after the other:
#     responses = iter(["ARACAJU, BELEM"])
#     monkeypatch.setattr('builtins.input', lambda _: next(responses))
#     desired = 2079

#     # Exercise
コード例 #4
0
ファイル: run.py プロジェクト: pikulo-kama/python-homework
if __name__ == '__main__':
    from app import app
    from app import controller

    app = app.App()
    app.addConfiguration({'SECRET_KEY': 'secret', 'WTF_CSRF_ENABLE': True})

    app.getApp().run(debug=True)
コード例 #5
0
 def __init__(self, *args, **kwargs):
     self.app = app.App()
コード例 #6
0
ファイル: test_app.py プロジェクト: adeoke/simple_rest_api
 def setUp(self):
     self.app = app.App()
コード例 #7
0
import trp.trp as tr
import app.app as application
import sys


if __name__ == "__main__":
    public_2 = 197
    public_1 = 151
    private_1 = 157
    trans_handler = tr.socket()
    tr.connect_to(trans_handler, "127.0.0.1", int(sys.argv[1]))

    app = application.App(tr, trans_handler, public_1, public_2, private_1, 'client', "message")
    app.transfer("Is working")
    message = app.transfer()

    msg = tr.recv(trans_handler)
    print(msg)

    tr.give(trans_handler, " UDP Server is working.")
    msg_new = tr.recv(trans_handler)
    print(msg_new)