From 938c4e505cc03e686441eb37c824b8862644ed7d Mon Sep 17 00:00:00 2001 From: Jason Axelson Date: Fri, 21 Jul 2023 11:11:11 -1000 Subject: [PATCH] WIP [skip-actions] --- felt/core/api_client.py | 2 +- felt/core/auth.py | 11 ++++++----- felt/gui/constants.py | 6 +++--- felt/metadata.txt | 2 +- felt/test/test_api_client.py | 16 ++++++++-------- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/felt/core/api_client.py b/felt/core/api_client.py index 02c5363..22bf354 100644 --- a/felt/core/api_client.py +++ b/felt/core/api_client.py @@ -49,7 +49,7 @@ class FeltApiClient: Client for the Felt API """ - URL = 'https://felt.com/api/v1' + URL = 'http://localhost:4000/api/v1' USER_ENDPOINT = '/user' CREATE_MAP_ENDPOINT = '/maps' CREATE_LAYER_ENDPOINT = '/maps/{}/layers' diff --git a/felt/core/auth.py b/felt/core/auth.py index 6dab046..c692ea0 100644 --- a/felt/core/auth.py +++ b/felt/core/auth.py @@ -32,11 +32,14 @@ from .pkce import generate_pkce_pair -OAUTH_BASE = "https://felt.com/oauth" +OAUTH_BASE = "http://localhost:4000/oauth" +CLIENT_ID = "8cb129bd-6962-4f65-8cc9-14b760e8436a" +# CLIENT_ID = "77e05a88-055b-43ee-88e4-c5c121a97882" + AUTH_HANDLER_REDIRECT = \ - OAUTH_BASE + "/success?client_id=8cb129bd-6962-4f65-8cc9-14b760e8436a" + OAUTH_BASE + "/success?client_id=" + CLIENT_ID AUTH_HANDLER_REDIRECT_CANCELLED = \ - OAUTH_BASE + "/denied?client_id=8cb129bd-6962-4f65-8cc9-14b760e8436a" + OAUTH_BASE + "/denied?client_id=" + CLIENT_ID AUTH_HANDLER_RESPONSE = """\ @@ -63,8 +66,6 @@ AUTH_URL = OAUTH_BASE + "/consent" TOKEN_URL = OAUTH_BASE + "/token" -CLIENT_ID = "8cb129bd-6962-4f65-8cc9-14b760e8436a" - REDIRECT_PORT = 8989 REDIRECT_URL = f"http://127.0.0.1:{REDIRECT_PORT}/" SCOPE = "map.write profile.read layer.write" diff --git a/felt/gui/constants.py b/felt/gui/constants.py index fe81b34..addc8ac 100644 --- a/felt/gui/constants.py +++ b/felt/gui/constants.py @@ -14,6 +14,6 @@ __revision__ = '$Format:%H$' -SIGNUP_URL = 'https://felt.com/signup' -TOS_URL = 'https://felt.com/terms' -PRIVACY_POLICY_URL = 'https://felt.com/privacy' +SIGNUP_URL = 'http://localhost:4000/signup' +TOS_URL = 'http://localhost:4000/terms' +PRIVACY_POLICY_URL = 'http://localhost:4000/privacy' diff --git a/felt/metadata.txt b/felt/metadata.txt index 20e60b8..910a19b 100644 --- a/felt/metadata.txt +++ b/felt/metadata.txt @@ -29,7 +29,7 @@ changelog=changelog # Tags are comma separated with spaces allowed tags=shared,collaboration,sharing,maps,publishing,public,comments,data,layers,realtime,cloud,media,browser,online,publication,webmapping,internet,webgis,capture,catalog -homepage=https://felt.com/ +homepage=http://localhost:4000/ category=Plugins icon=icon.svg # experimental flag diff --git a/felt/test/test_api_client.py b/felt/test/test_api_client.py index b38bf86..6ca0a8a 100644 --- a/felt/test/test_api_client.py +++ b/felt/test/test_api_client.py @@ -65,7 +65,7 @@ def test_build_url(self): """ self.assertEqual( FeltApiClient.build_url('/user'), - QUrl('https://felt.com/api/v1/user') + QUrl('http://localhost:4000/api/v1/user') ) def test_to_url_query(self): @@ -92,7 +92,7 @@ def test_build_request(self): """ res = FeltApiClient()._build_request('/test') self.assertIsInstance(res, QNetworkRequest) - self.assertEqual(res.url().toString(), 'https://felt.com/api/v1/test') + self.assertEqual(res.url().toString(), 'http://localhost:4000/api/v1/test') self.assertTrue(res.hasRawHeader(b'accept')) self.assertEqual(res.rawHeader(b'accept'), b'application/json') @@ -100,7 +100,7 @@ def test_build_request(self): res = FeltApiClient()._build_request('/test', {'custom': 'custom_header'}) self.assertIsInstance(res, QNetworkRequest) - self.assertEqual(res.url().toString(), 'https://felt.com/api/v1/test') + self.assertEqual(res.url().toString(), 'http://localhost:4000/api/v1/test') self.assertTrue(res.hasRawHeader(b'accept')) self.assertEqual(res.rawHeader(b'accept'), b'application/json') self.assertTrue(res.hasRawHeader(b'custom')) @@ -110,7 +110,7 @@ def test_build_request(self): res = FeltApiClient()._build_request('/test', params={'a': 'b'}) self.assertIsInstance(res, QNetworkRequest) self.assertEqual(res.url().toString(), - 'https://felt.com/api/v1/test?a=b') + 'http://localhost:4000/api/v1/test?a=b') self.assertTrue(res.hasRawHeader(b'accept')) self.assertEqual(res.rawHeader(b'accept'), b'application/json') @@ -124,7 +124,7 @@ def test_user(self): spy = QSignalSpy(reply.finished) self.assertIsInstance(reply, QNetworkReply) self.assertEqual(reply.request().url().toString(), - 'https://felt.com/api/v1/user') + 'http://localhost:4000/api/v1/user') spy.wait() @@ -136,7 +136,7 @@ def test_user(self): spy = QSignalSpy(reply.finished) self.assertIsInstance(reply, QNetworkReply) self.assertEqual(reply.request().url().toString(), - 'https://felt.com/api/v1/user') + 'http://localhost:4000/api/v1/user') spy.wait() @@ -159,7 +159,7 @@ def test_create_map(self): spy = QSignalSpy(reply.finished) self.assertIsInstance(reply, QNetworkReply) self.assertEqual(reply.request().url().toString(), - 'https://felt.com/api/v1/maps') + 'http://localhost:4000/api/v1/maps') spy.wait() @@ -172,7 +172,7 @@ def test_create_map(self): spy = QSignalSpy(reply.finished) self.assertIsInstance(reply, QNetworkReply) self.assertEqual(reply.request().url().toString(), - 'https://felt.com/api/v1/maps') + 'http://localhost:4000/api/v1/maps') spy.wait()