Skip to content

Commit

Permalink
+comments & code improvements to improve linter score
Browse files Browse the repository at this point in the history
  • Loading branch information
vantage-ola committed Oct 9, 2024
1 parent 27accb2 commit 1bd54b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 1 addition & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Flask Application
'''
from flask import Flask, jsonify, request
from models import Experience, Education, Skill, User
#from models import Experience, Education, Skill, User
from utils import check_phone_number, correct_spelling, load_data
app = Flask(__name__)

Expand Down Expand Up @@ -33,7 +33,6 @@ def user():
name = body['name']
phone_number = body['phone_number']
email = body['email_address']

if not check_phone_number(phone_number):
return jsonify({"error": "Incorrect phone number"}), 400

Expand All @@ -44,10 +43,8 @@ def user():
'phone_number': phone_number,
'email_address': email
}

data['user'].append(new_user)
return jsonify(new_user), 201

if request.method == 'PUT':
# Find the user by email and update their information

Expand Down
6 changes: 6 additions & 0 deletions test_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ def test_correct_spelling(text, expected):

@pytest.fixture
def setup_teardown():
'''
Setup temporary file to test load_data
'''
# Create a temporary directory and file for testing
with tempfile.TemporaryDirectory() as temp_dir:
test_file_path = os.path.join(temp_dir, 'test_resume.json')
Expand Down Expand Up @@ -188,6 +191,9 @@ def setup_teardown():
yield test_file_path, test_data

def test_load_data(setup_teardown):
'''
Test the load_data util function
'''
test_file_path, test_data = setup_teardown

# Test if the load_data function successfully loads the data
Expand Down

0 comments on commit 1bd54b8

Please sign in to comment.