Skip to content

Commit

Permalink
Create tst firebase_admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Boomaa23 committed Oct 4, 2024
1 parent 3b65daa commit 02b55cd
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install dependencies
run: |
cd server
python -m pip install -r requirements.txt
python -m pip install -r requirements-tst.txt
- name: Run all unit tests
run: |
cd server
Expand Down
10 changes: 10 additions & 0 deletions server/requirements-tst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
doc8
flask==3.0.3
flask-cors==5.0.0
pillow~=10.4.0
pre-commit~=3.5.0
pytest==8.3.2
python-dotenv==1.0.0
sphinx~=7.1.2
sphinx-rtd-theme==2.0.0
werkzeug==3.0.3
6 changes: 2 additions & 4 deletions server/src/api_user_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import models
from firebase_admin import auth as fauth
from firebase_admin import credentials
from flask import jsonify
from identifier import Identifier

api_user_blueprint = flask.Blueprint('api_user', __name__)
Expand Down Expand Up @@ -52,12 +51,11 @@ def google_auth_user():
decoded_token = fauth.verify_id_token(token)
user_id = decoded_token['uid']
if not db.get_user_id_exists(user_id):
print('CREATING USER')
create_user(user_id, name, DEFAULT_AUTHMASK)

return jsonify({'name': name, 'id': user_id})
return flask.jsonify({'name': name, 'id': user_id})
except Exception as e:
return jsonify({'error': str(e)}), 401
return flask.jsonify({'error': str(e)}), 401


@api_user_blueprint.route('/api/user/get', methods=['POST'])
Expand Down
2 changes: 2 additions & 0 deletions server/tst/firebase_admin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def initialize_app(cred):
pass
2 changes: 2 additions & 0 deletions server/tst/firebase_admin/auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def verify_id_token(token):
pass
3 changes: 3 additions & 0 deletions server/tst/firebase_admin/credentials.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Certificate:
def __init__(self, path):
pass

0 comments on commit 02b55cd

Please sign in to comment.