From 06964c1bd3f8c5f1eab1dfa0a017903cc5a19766 Mon Sep 17 00:00:00 2001 From: Eric Asante Date: Wed, 30 Oct 2024 16:12:50 -0400 Subject: [PATCH] API STUB and TEST Complete --- Backend/PetFuc.py | 9 ++ Backend/UserFuc.py | 28 ++++ Backend/__pycache__/PetFuc.cpython-310.pyc | Bin 0 -> 468 bytes Backend/__pycache__/UserFuc.cpython-310.pyc | Bin 0 -> 804 bytes .../test_main.cpython-310-pytest-8.3.3.pyc | Bin 0 -> 2085 bytes Backend/main.py | 45 ++++++ Backend/test_main.py | 132 ++++++++++++++++++ 7 files changed, 214 insertions(+) create mode 100644 Backend/PetFuc.py create mode 100644 Backend/UserFuc.py create mode 100644 Backend/__pycache__/PetFuc.cpython-310.pyc create mode 100644 Backend/__pycache__/UserFuc.cpython-310.pyc create mode 100644 Backend/__pycache__/test_main.cpython-310-pytest-8.3.3.pyc create mode 100644 Backend/main.py create mode 100644 Backend/test_main.py diff --git a/Backend/PetFuc.py b/Backend/PetFuc.py new file mode 100644 index 0000000..bb0475a --- /dev/null +++ b/Backend/PetFuc.py @@ -0,0 +1,9 @@ +from flask import Flask, json, request, jsonify + + +def Get_Random_Pet(): + randomint = "9" # APi generates random interger that represents a PET ID + # Api accesses database and return information in data base + #Retrun information such as profile picture on the pet accosiated with the random ID + return jsonify({"id": randomint,"name":"sam","sex":"male","Age":"8", "location":"Connecticwut", "Breed": "Pug"}) # Return dog information + diff --git a/Backend/UserFuc.py b/Backend/UserFuc.py new file mode 100644 index 0000000..30dae00 --- /dev/null +++ b/Backend/UserFuc.py @@ -0,0 +1,28 @@ +from flask import Flask, request, json, jsonify + +UserFaviorteDataBase = [] # pretend this is a database + +UserAccInfo = {"Name":"eric","Password":"2020", "Location":"connecticut","Occupation":"Student"} # example user information + +# add user faviorte pet to database +def Add_User_Faviorte(jsondata): + UserFaviorteDataBase.append(jsondata) + + # accesses database and append post json in database + return UserFaviorteDataBase # return new user database + + +# Remove user faviorte pet to database +def Remove_User_Faviorte(jsondata): + UserFaviorteDataBase.remove(jsondata) + + # accesses database and append post json in database + return UserFaviorteDataBase # return new user database + + +# Change a Users account location +def Replace_User_Location(NewLocation): + NewLocation = NewLocation.get('Location') + + UserAccInfo["Location"] = NewLocation # Set location accosiated with user to new location + return UserAccInfo # retrun user account info diff --git a/Backend/__pycache__/PetFuc.cpython-310.pyc b/Backend/__pycache__/PetFuc.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..67e63b8a4e8c0d9254cddac8fc0e272f6e17348b GIT binary patch literal 468 zcmYjNu}&N@5VhCdy9)xEBq&OWXts$16-ZGOIN&;T0;Smot?c2nu(rYWDj-1>J_A00 zpWs8LO~o%zWxNs+BhAyy`035__?499ZT$XP&U$(W@N?>qraT=Cr8M4P{hWfv`q)dw{dyuodca({ijbT=KZ1?VbL0t zuCYL5xJI$N0GxDQH>o8<I~B9@gRRnQ<*=R wLGm>bK2vc-Zp*WLt&r~>M25^5%ng*m(mVJ>uQ>T(z3DsnneR79eqqbvKZ$~LO8@`> literal 0 HcmV?d00001 diff --git a/Backend/__pycache__/UserFuc.cpython-310.pyc b/Backend/__pycache__/UserFuc.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f147aa9c8ad1c8453254026b409d6f5e24c35d5 GIT binary patch literal 804 zcmZ`%OK;RL5VjNV#?3x>XbVM%3kRfJ$g<}O(FY4iXsNp5l1mlY-qp67IM`0BO6A6# zKfs|q?(g7V_{xbhH%`o?tW=O{$)CrW%s1bRNB4R$f%WX`)A{$1kRN!txms{}1>24R zB$0GU3YyU($burw!h&Utk~zs*GLWHUvL)N!Sk{)2OqoMBzU6x9?g{Ym6rmmK%bU?u- zd7(T%$gMroMtc5Ui`*@MCjKBqT{X6#nDFmH8!9Dxuz&Rd9J!%bex?5vZ62y>nG1C-Y5mt0kl8jsOnJbl zc>?AniG6E^^J4e&F zF3m%8?39j(rFCM{M(OMl+C=}ZIk9O=Iw$VLcxH$j5U-VFLijpZ9$FcJIN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