Example #1
0
    def test_call_with_params(self):
        leaf = Leaf(VIN=VIN, custom_sessionid=custom_sessionid)

        response = leaf.BatteryStatusCheckRequest()
        assert response['status'] == 200
        #time.sleep(140)   # only need to pause here when running against live service
        response2 = leaf.BatteryStatusCheckResultRequest(
            resultKey=response['resultKey'])
        assert response2['status'] == 200
Example #2
0
    def test_call_to_nonexistent_endpoint(self):
        leaf = Leaf(VIN=VIN, custom_sessionid=custom_sessionid)

        with self.assertRaises(Exception):
            response = leaf.this_doesnt_exist()
Example #3
0
 def test_login_with_no_args_raises_exception(self):
     with self.assertRaises(Exception):
         leaf = Leaf()
Example #4
0
    def test_call_with_no_params(self):
        leaf = Leaf(VIN=VIN, custom_sessionid=custom_sessionid)

        result = leaf.BatteryStatusRecordsRequest()

        assert result['status'] == 200
Example #5
0
 def test_login_with_only_VIN_raises_exception(self):
     with self.assertRaises(Exception):
         leaf = Leaf(VIN='vin123')
Example #6
0
 def test_login_with_only_custom_sessionid_raises_exception(self):
     with self.assertRaises(Exception):
         leaf = Leaf(custom_sessionid='vin123')
Example #7
0
 def test_login_with_only_username_raises_exception(self):
     with self.assertRaises(Exception):
         leaf = Leaf('username')
Example #8
0
    def test_exception_raised_when_bad_vin_and_customsessionid_used(self):

        leaf = Leaf(VIN='vin345', custom_sessionid='csid123')

        with self.assertRaises(Exception) as w:
            leaf.BatteryStatusRecordsRequest()
Example #9
0
 def test_exeption_raised_when_bad_credentials_passed(self):
     with self.assertRaises(Exception) as w:
         leaf = Leaf('*****@*****.**', 'invalidpassword')
Example #10
0
    def test_login_with_custom_sessionid_and_vin(self):
        leaf = Leaf(VIN='vin345', custom_sessionid='csid123')

        assert leaf.VIN == 'vin345'
        assert leaf.custom_sessionid == 'csid123'
Example #11
0
    def test_login(self):
        leaf = Leaf(USERNAME, PASSWORD)

        assert leaf.VIN == "vin123"
        assert leaf.custom_sessionid == "csessid"