예제 #1
0
def main():
    """ 
    This function determines which functionality the user would like to use, and calls it
    """
    print("Welcome to smartOBD")
    print("Choose your action:\n")
    print("(0) Async allows smartOBD to give you live data on your vehicle\n")
    print("(1) Full Read will store all the data from your car's computer\n")
    choose_action = input("Async(0) or Full Read(1): ")
    # * make database connection
    # host=198.23.146.166  password=Sweden77
    ## asynchronous
    # @param choose_action The action
    if (choose_action == '0'):
        asynco.getAsync(60)

        # x = 0
        # while x < 30:
        #     data = [datetime.datetime.now()]
        #     asynco.new_speed(x+3, data)
        #     asynco.new_rpm(1000+x, data)
        #     asynco.new_temp(150+x, data)
        #     asynco.new_fuel(35+x, data, dbtable, dbconn, cur)
        #     x += 1
    ## full query
    elif (choose_action == '1'):
        test_commands.fullQuery()
예제 #2
0
 def test_failed_car(self):
     test_failcar = StringIO('walkerwg\nj\na\n')
     sys.stdin = test_failcar
     with pytest.raises(SystemExit):
         test_commands.fullQuery()
     test_failcar = StringIO('walkerwg\nj\na\n')
     sys.stdin = test_failcar
     with pytest.raises(SystemExit):
         asynco.getAsync(60)
예제 #3
0
 def test_failed_username(self):
     main_input1 = StringIO('0')
     sys.stdin = main_input1
     with pytest.raises(SystemExit):
         test_commands.fullQuery()
     main_input1 = StringIO('0')
     sys.stdin = main_input1
     with pytest.raises(SystemExit):
         asynco.getAsync(60)
예제 #4
0
 def test_getAsync(self):
     test_multicar = StringIO('walkerwg\nmini\njcw\n')
     sys.stdin = test_multicar
     asynco.getAsync(10)