コード例 #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_single_car(self, capsys):
     sys.stdin = test_singlecar
     test_commands.fullQuery()
     captured = capsys.readouterr()
     assert captured.out == 'Please input your username from the website so we can upload your information to your account: Failed OBD-II Query, please try again\n'
コード例 #5
0
 def test_assert_multi_car(self, capsys):
     sys.stdin = test_multicar
     test_commands.fullQuery()
     captured = capsys.readouterr()
     assert captured.out == 'Please input your username from the website so we can upload your information to your account: Looks like you have more than one car, which car would you like to access?\n\nMake: Model: Failed OBD-II Query, please try again\n'
コード例 #6
0
 def test_fullQuery(self):
     test_multicar = StringIO('walkerwg\nmini\njcw\n')
     sys.stdin = test_multicar
     test_commands.fullQuery()