Ejemplo n.º 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
Ejemplo n.º 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()
Ejemplo n.º 3
0
 def test_login_with_no_args_raises_exception(self):
     with self.assertRaises(Exception):
         leaf = Leaf()
Ejemplo n.º 4
0
    def test_call_with_no_params(self):
        leaf = Leaf(VIN=VIN, custom_sessionid=custom_sessionid)

        result = leaf.BatteryStatusRecordsRequest()

        assert result['status'] == 200
Ejemplo n.º 5
0
 def test_login_with_only_VIN_raises_exception(self):
     with self.assertRaises(Exception):
         leaf = Leaf(VIN='vin123')
Ejemplo n.º 6
0
 def test_login_with_only_custom_sessionid_raises_exception(self):
     with self.assertRaises(Exception):
         leaf = Leaf(custom_sessionid='vin123')
Ejemplo n.º 7
0
 def test_login_with_only_username_raises_exception(self):
     with self.assertRaises(Exception):
         leaf = Leaf('username')
Ejemplo n.º 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()
Ejemplo n.º 9
0
 def test_exeption_raised_when_bad_credentials_passed(self):
     with self.assertRaises(Exception) as w:
         leaf = Leaf('*****@*****.**', 'invalidpassword')
Ejemplo n.º 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'
Ejemplo n.º 11
0
    def test_login(self):
        leaf = Leaf(USERNAME, PASSWORD)

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