Skip to content

Commit c105c09

Browse files
Testing all Py API after libs update
Signed-off-by: Lukasz Gryglicki <[email protected]>
1 parent e6ea3a5 commit c105c09

File tree

5 files changed

+54
-0
lines changed

5 files changed

+54
-0
lines changed

cla-backend/cla/auth.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ def get_auth_token(headers):
6363

6464
return parts[1]
6565

66+
# LG: for local testing
67+
def fake_authenticate_user(headers):
68+
return AuthUser({'name': 'Lukasz Gryglicki', 'email': '[email protected]', 'username': 'lukaszgryglicki', 'sub': ''})
6669

6770
def authenticate_user(headers):
6871
"""

cla-backend/cla/routes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def process_data(request, response, resource):
6767
@hug.directive()
6868
def check_auth(request=None, **kwargs):
6969
"""Returns the authenticated user"""
70+
# LG:
71+
# return request and cla.auth.fake_authenticate_user(request.headers)
7072
return request and cla.auth.authenticate_user(request.headers)
7173

7274

utils/get_user_py.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# API_URL=https://[xyz].ngrok-free.app (defaults to localhost:5000)
3+
# API_URL=https://api.lfcla.dev.platform.linuxfoundation.org
4+
if [ -z "$1" ]
5+
then
6+
echo "$0: you need to specify user_id as a 1st parameter, example '9dcf5bbc-2492-11ed-97c7-3e2a23ea20b5', '55775b48-69c1-474d-a07a-2a329e7012b4'"
7+
exit 1
8+
fi
9+
export user_id="$1"
10+
11+
if [ -z "$API_URL" ]
12+
then
13+
export API_URL="http://localhost:5000"
14+
fi
15+
16+
API="${API_URL}/v2/user/${user_id}"
17+
18+
if [ ! -z "$DEBUG" ]
19+
then
20+
echo "curl -s -XGET -H \"Content-Type: application/json\" \"${API}\""
21+
curl -s -XGET -H "Content-Type: application/json" "${API}"
22+
else
23+
curl -s -XGET -H "Content-Type: application/json" "${API}" | jq -r '.'
24+
fi

utils/get_user_signatures_py.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# API_URL=https://[xyz].ngrok-free.app (defaults to localhost:5000)
3+
# API_URL=https://api.lfcla.dev.platform.linuxfoundation.org
4+
if [ -z "$1" ]
5+
then
6+
echo "$0: you need to specify user_id as a 1st parameter, example '9dcf5bbc-2492-11ed-97c7-3e2a23ea20b5', '55775b48-69c1-474d-a07a-2a329e7012b4'"
7+
exit 1
8+
fi
9+
export user_id="$1"
10+
11+
if [ -z "$API_URL" ]
12+
then
13+
export API_URL="http://localhost:5000"
14+
fi
15+
16+
API="${API_URL}/v1/user/${user_id}/signatures"
17+
18+
if [ ! -z "$DEBUG" ]
19+
then
20+
echo "curl -s -XGET -H \"Content-Type: application/json\" \"${API}\""
21+
curl -s -XGET -H "Content-Type: application/json" "${API}"
22+
else
23+
curl -s -XGET -H "Content-Type: application/json" "${API}" | jq -r '.'
24+
fi

utils/health_v2.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
# API_URL=https://[xyz].ngrok-free.app (defaults to localhost:5000)
3+
# API_URL=https://api.lfcla.dev.platform.linuxfoundation.org
34
if [ -z "$API_URL" ]
45
then
56
export API_URL="http://localhost:5000"

0 commit comments

Comments
 (0)