How to use the smartcar.AuthClient function in smartcar

To help you get started, we’ve selected a few smartcar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github smartcar / python-sdk / tests / test_smartcar.py View on Github external
def test_get_auth_url_development_true(self):
        client = smartcar.AuthClient(self.client_id, self.client_secret,
                self.redirect_uri, self.scope, development=True)
        actual = client.get_auth_url(force=True, state='stuff')
        query = urlencode({
            'response_type': 'code',
            'client_id': self.client_id,
            'redirect_uri': self.redirect_uri,
            'approval_prompt': 'force',
            'mode': 'test',
            'scope': ' '.join(self.scope),
            'state': 'stuff'
        })
        expected = smartcar.const.CONNECT_URL + '/oauth/authorize?' + query

        expected_params = parse_qs(expected)
        actual_params = parse_qs(actual)
github smartcar / python-sdk / tests / tests_e2e / test_base.py View on Github external
'required:control_security:unlock',
            'required:control_security:lock',
            'required:read_vehicle_info',
            'required:read_vin',
            'required:read_location',
            'required:read_odometer',
            'required:read_fuel',
            'required:read_engine_oil',
            'required:read_tires',
            'required:read_battery',
            'required:read_charge',
            'required:control_charge',
        ]
        test_mode = True

        cls.client = smartcar.AuthClient(
            client_id,
            client_secret,
            redirect_uri,
            scope,
            test_mode
        )

        cls.driver = webdriver.Remote(
            command_executor='http://127.0.0.1:4444/wd/hub',
            desired_capabilities=DesiredCapabilities.CHROME,
            keep_alive=True)

        auth_url = cls.client.get_auth_url()

        cls.code = get_code(cls.driver, auth_url)
github smartcar / python-sdk / tests / test_smartcar.py View on Github external
def test_get_auth_url_single_select_bool(self):
        client = smartcar.AuthClient(self.client_id, self.client_secret,
                self.redirect_uri, self.scope, development=False)

        actual = client.get_auth_url(force=True, state='stuff', single_select=True)

        query = urlencode({
            'response_type': 'code',
            'client_id': self.client_id,
            'redirect_uri': self.redirect_uri,
            'approval_prompt': 'force',
            'state': 'stuff',
            'scope': ' '.join(self.scope),
            'single_select': True
        })

        expected = smartcar.const.CONNECT_URL + '/oauth/authorize?' + query
github smartcar / python-sdk / tests / test_smartcar.py View on Github external
def test_get_auth_url_test_mode_true(self):
        client = smartcar.AuthClient(self.client_id, self.client_secret,
                self.redirect_uri, self.scope, test_mode=True)
        actual = client.get_auth_url(force=True, state='stuff')
        query = urlencode({
            'response_type': 'code',
            'client_id': self.client_id,
            'redirect_uri': self.redirect_uri,
            'approval_prompt': 'force',
            'mode': 'test',
            'scope': ' '.join(self.scope),
            'state': 'stuff'
        })
        expected = smartcar.const.CONNECT_URL + '/oauth/authorize?' + query

        expected_params = parse_qs(expected)
        actual_params = parse_qs(actual)
github smartcar / python-sdk / tests / test_smartcar.py View on Github external
def test_get_auth_url_vehicle_info_dictionary(self):
        info = {
            'make': 'TESLA'
        }

        client = smartcar.AuthClient(self.client_id, self.client_secret,
                self.redirect_uri, self.scope, development=False)

        actual = client.get_auth_url(force=True, state='stuff', vehicle_info=info)

        query = urlencode({
            'response_type': 'code',
            'client_id': self.client_id,
            'redirect_uri': self.redirect_uri,
            'approval_prompt': 'force',
            'state': 'stuff',
            'scope': ' '.join(self.scope),
            'make': 'TESLA'
        })

        expected = smartcar.const.CONNECT_URL + '/oauth/authorize?' + query
github smartcar / python-sdk / tests / test_smartcar.py View on Github external
def test_get_auth_url(self):
        client = smartcar.AuthClient(self.client_id, self.client_secret,
                self.redirect_uri, self.scope)
        actual = client.get_auth_url(force=True, state='stuff')
        query = urlencode({
            'response_type': 'code',
            'client_id': self.client_id,
            'redirect_uri': self.redirect_uri,
            'approval_prompt': 'force',
            'scope': ' '.join(self.scope),
            'state': 'stuff'
        })
        expected = smartcar.const.CONNECT_URL + '/oauth/authorize?' + query

        expected_params = parse_qs(expected)
        actual_params = parse_qs(actual)

        assertDeepEquals(self, expected_params, actual_params)
github smartcar / python-sdk / tests / test_smartcar.py View on Github external
def test_get_auth_url_test_mode_false(self):
        client = smartcar.AuthClient(self.client_id, self.client_secret,
                self.redirect_uri, self.scope, test_mode=False)
        actual = client.get_auth_url(force=True, state='stuff')
        query = urlencode({
            'response_type': 'code',
            'client_id': self.client_id,
            'redirect_uri': self.redirect_uri,
            'approval_prompt': 'force',
            'scope': ' '.join(self.scope),
            'state': 'stuff'
        })
        expected = smartcar.const.CONNECT_URL + '/oauth/authorize?' + query

        expected_params = parse_qs(expected)
        actual_params = parse_qs(actual)

        assertDeepEquals(self, expected_params, actual_params)
github smartcar / python-sdk / tests / test_smartcar.py View on Github external
def test_get_auth_url_test_mode_no_keyword_true(self):
        client = smartcar.AuthClient(self.client_id, self.client_secret,
                self.redirect_uri, self.scope, True)
        actual = client.get_auth_url(force=True, state='stuff')
        query = urlencode({
            'response_type': 'code',
            'client_id': self.client_id,
            'redirect_uri': self.redirect_uri,
            'approval_prompt': 'force',
            'mode': 'test',
            'scope': ' '.join(self.scope),
            'state': 'stuff'
        })
        expected = smartcar.const.CONNECT_URL + '/oauth/authorize?' + query

        expected_params = parse_qs(expected)
        actual_params = parse_qs(actual)
github smartcar / python-sdk / tests / test_smartcar.py View on Github external
def test_get_auth_url_single_select_junk_keys(self):
        info = {
            'pizza': 'TESLA'
        }
        
        client = smartcar.AuthClient(self.client_id, self.client_secret,
                self.redirect_uri, self.scope, development=False)

        actual = client.get_auth_url(force=True, state='stuff', single_select='potato')

        query = urlencode({
            'response_type': 'code',
            'client_id': self.client_id,
            'redirect_uri': self.redirect_uri,
            'approval_prompt': 'force',
            'state': 'stuff',
            'scope': ' '.join(self.scope),
            'single_select': False
        })

        expected = smartcar.const.CONNECT_URL + '/oauth/authorize?' + query