Skip to content

Commit

Permalink
even more pylint debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
IshayuR committed Oct 31, 2024
1 parent b641f04 commit b3a0e86
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
7 changes: 3 additions & 4 deletions Backend/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Module main.py
# This module is the main entry point for the pet adoption web application.
# It defines routes and their functions for managing pets and user information.
""" This module is the main entry point for the pet adoption web application.
It defines routes and their functions for managing pets and user information. """
from flask import Flask, request, jsonify
from pet_func import get_random_pet
from user_func import add_user_favorite, remove_user_favorite, replace_user_location
Expand Down Expand Up @@ -33,4 +32,4 @@ def replace_user_information():
return jsonify(replace_user_location(new_location)), 200

if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000, debug=True)
app.run(host="0.0.0.0", port=5000, debug=True)
5 changes: 2 additions & 3 deletions Backend/pet_func.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Module pet_func.py
# This module handles pet-related functionalities, providing details about random pets.
# It uses the Flask framework to return pet information in a JSON format.
""" This module handles pet-related functionalities, providing details about random pets.
It uses the Flask framework to return pet information in a JSON format. """
from flask import jsonify

def get_random_pet():
Expand Down
7 changes: 3 additions & 4 deletions Backend/test_main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Module test_main.py
# This module contains unit tests for the pet adoption web application, testing the functionality
# of various endpoints. It uses the requests library to simulate HTTP requests.
""" This module contains unit tests for the pet adoption web application, testing the functionality
of various endpoints. It uses the requests library to simulate HTTP requests. """
import requests

def test_get_random_pet():
Expand Down Expand Up @@ -39,4 +38,4 @@ def test_change_user_location():
"""Test for http://localhost:5000/change_user_location."""
url = "http://localhost:5000"
response = requests.put(f"{url}/change_user_location", json={"Location": "New York"}, timeout=10)
assert response.json() == {"Location": "New York", "Name": "Eric", "Occupation": "Student", "Password": "2020"}
assert response.json() == {"Location": "New York", "Name": "Eric", "Occupation": "Student", "Password": "2020"}
12 changes: 8 additions & 4 deletions Backend/user_func.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Module user_func.py
# This module handles user-related functionalities such as managing favorites and updating user information.
""" This module handles user-related functionalities such as managing favorites and updating user information. """

user_favorite_database = [] # Simulate a database for user favorites
user_acc_info = {"Name": "Eric", "Password": "2020", "Location": "Connecticut", "Occupation": "Student"}
user_acc_info = {
"Name": "Eric",
"Password": "2020",
"Location": "Connecticut",
"Occupation": "Student"
}

def add_user_favorite(json_data):
"""Add user favorite pet to the database."""
Expand All @@ -18,4 +22,4 @@ def replace_user_location(new_location):
"""Change the user account location."""
new_location = new_location.get("Location")
user_acc_info["Location"] = new_location # Set new location associated with the user
return user_acc_info # Return updated user account information
return user_acc_info # Return updated user account information

0 comments on commit b3a0e86

Please sign in to comment.