Skip to content

Commit

Permalink
WIP [skip-actions]
Browse files Browse the repository at this point in the history
  • Loading branch information
axelson committed Aug 16, 2023
1 parent f8b2930 commit 938c4e5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion felt/core/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
11 changes: 6 additions & 5 deletions felt/core/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """\
<html>
Expand All @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions felt/gui/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion felt/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions felt/test/test_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -92,15 +92,15 @@ 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')

# with extra headers
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'))
Expand All @@ -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')

Expand All @@ -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()

Expand All @@ -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()

Expand All @@ -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()

Expand All @@ -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()

Expand Down

0 comments on commit 938c4e5

Please sign in to comment.