Skip to content

Commit bcfeefd

Browse files
committed
Added "." at the end of returned jsons
1 parent 1dc067f commit bcfeefd

File tree

14 files changed

+81
-82
lines changed

14 files changed

+81
-82
lines changed

PyMatcha.postman_collection.json

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"tests[\"JSON return code is 400\"] = response.code == 400",
7474
"",
7575
"tests[\"success is false\"] = response.success == false",
76-
"tests[\"Message is correct\"] = response.error.message == \"The Json Body is malformed\"",
76+
"tests[\"Message is correct\"] = response.error.message == \"The Json Body is malformed.\"",
7777
"tests[\"Error type is Bad Request\"] = response.error.type == \"BadRequestError\""
7878
],
7979
"type": "text/javascript"
@@ -771,7 +771,7 @@
771771
"tests[\"JSON return code is 400\"] = response.code == 400",
772772
"",
773773
"tests[\"success is false\"] = response.success == false",
774-
"tests[\"Message is correct\"] = response.error.message == \"The Json Body is malformed\"",
774+
"tests[\"Message is correct\"] = response.error.message == \"The Json Body is malformed.\"",
775775
"tests[\"Error type is Bad Request\"] = response.error.type == \"BadRequestError\""
776776
],
777777
"type": "text/javascript"
@@ -1758,7 +1758,7 @@
17581758
"tests[\"JSON return code is 400\"] = response.code == 400",
17591759
"",
17601760
"tests[\"success is true\"] = response.success == false",
1761-
"tests[\"Message is correct\"] = response.error.message == \"Bio is too short\"",
1761+
"tests[\"Message is correct\"] = response.error.message == \"Bio is too short.\"",
17621762
"tests[\"Error type is Bad Request\"] = response.error.type == \"BadRequestError\""
17631763
],
17641764
"type": "text/javascript"
@@ -1808,7 +1808,7 @@
18081808
"tests[\"JSON return code is 400\"] = response.code == 400",
18091809
"",
18101810
"tests[\"success is true\"] = response.success == false",
1811-
"tests[\"Message is correct\"] = response.error.message == \"At least 3 tags are required\"",
1811+
"tests[\"Message is correct\"] = response.error.message == \"At least 3 tags are required.\"",
18121812
"tests[\"Error type is Bad Request\"] = response.error.type == \"BadRequestError\""
18131813
],
18141814
"type": "text/javascript"
@@ -1858,7 +1858,7 @@
18581858
"tests[\"JSON return code is 400\"] = response.code == 400",
18591859
"",
18601860
"tests[\"success is true\"] = response.success == false",
1861-
"tests[\"Message is correct\"] = response.error.message == \"Duplicate tags\"",
1861+
"tests[\"Message is correct\"] = response.error.message == \"Duplicate tags.\"",
18621862
"tests[\"Error type is Bad Request\"] = response.error.type == \"BadRequestError\""
18631863
],
18641864
"type": "text/javascript"
@@ -1908,7 +1908,7 @@
19081908
"tests[\"JSON return code is 400\"] = response.code == 400",
19091909
"",
19101910
"tests[\"success is true\"] = response.success == false",
1911-
"tests[\"Message is correct\"] = response.error.message == \"You must be 18 years old or older\"",
1911+
"tests[\"Message is correct\"] = response.error.message == \"You must be 18 years old or older.\"",
19121912
"tests[\"Error type is Bad Request\"] = response.error.type == \"BadRequestError\""
19131913
],
19141914
"type": "text/javascript"
@@ -3231,7 +3231,7 @@
32313231
"tests[\"JSON return code is 404\"] = response.code == 404",
32323232
"",
32333233
"tests[\"success is true\"] = response.success == false",
3234-
"tests[\"Message is correct\"] = response.error.message == \"User -1 not found\"",
3234+
"tests[\"Message is correct\"] = response.error.message == \"User -1 not found.\"",
32353235
"tests[\"Error type is Bad Request\"] = response.error.type == \"NotFoundError\""
32363236
],
32373237
"type": "text/javascript"
@@ -3333,8 +3333,7 @@
33333333
"tests[\"JSON return code is 200\"] = response.code == 200",
33343334
"",
33353335
"tests[\"success is true\"] = response.success == true",
3336-
"tests[\"Message is correct\"] = response.message == \"Report created on user report_me@example.org\"",
3337-
""
3336+
"tests[\"Message is correct\"] = response.message == \"Report created on user report_me@example.org.\""
33383337
],
33393338
"type": "text/javascript"
33403339
}
@@ -3502,7 +3501,7 @@
35023501
"tests[\"JSON return code is 400\"] = response.code == 400",
35033502
"",
35043503
"tests[\"success is true\"] = response.success == false",
3505-
"tests[\"Message is correct\"] = response.error.message == \"Cannot report yourself\"",
3504+
"tests[\"Message is correct\"] = response.error.message == \"Cannot report yourself.\"",
35063505
""
35073506
],
35083507
"type": "text/javascript"
@@ -3566,7 +3565,7 @@
35663565
"tests[\"JSON return code is 404\"] = response.code == 404",
35673566
"",
35683567
"tests[\"success is false\"] = response.success == false",
3569-
"tests[\"Message is correct\"] = response.error.message == \"User -1 not found\"",
3568+
"tests[\"Message is correct\"] = response.error.message == \"User -1 not found.\"",
35703569
"tests[\"Error type is Bad Request\"] = response.error.type == \"NotFoundError\""
35713570
],
35723571
"type": "text/javascript"
@@ -3607,7 +3606,7 @@
36073606
"tests[\"JSON return code is 400\"] = response.code == 400",
36083607
"",
36093608
"tests[\"success is false\"] = response.success == false",
3610-
"tests[\"Message is correct\"] = response.error.message == \"Cannot like yourself\"",
3609+
"tests[\"Message is correct\"] = response.error.message == \"Cannot like yourself.\"",
36113610
"tests[\"Error type is Bad Request\"] = response.error.type == \"BadRequestError\""
36123611
],
36133612
"type": "text/javascript"
@@ -3740,7 +3739,7 @@
37403739
"tests[\"JSON return code is 400\"] = response.code == 400",
37413740
"",
37423741
"tests[\"success is false\"] = response.success == false",
3743-
"tests[\"Message is correct\"] = response.error.message == \"You already liked this person\"",
3742+
"tests[\"Message is correct\"] = response.error.message == \"You already liked this person.\"",
37443743
"tests[\"Error type is Bad Request\"] = response.error.type == \"BadRequestError\""
37453744
],
37463745
"type": "text/javascript"
@@ -3788,7 +3787,7 @@
37883787
"tests[\"JSON return code is 404\"] = response.code == 404",
37893788
"",
37903789
"tests[\"success is false\"] = response.success == false",
3791-
"tests[\"Message is correct\"] = response.error.message == \"User -1 not found\"",
3790+
"tests[\"Message is correct\"] = response.error.message == \"User -1 not found.\"",
37923791
"tests[\"Error type is Bad Request\"] = response.error.type == \"NotFoundError\""
37933792
],
37943793
"type": "text/javascript"
@@ -3829,7 +3828,7 @@
38293828
"tests[\"JSON return code is 400\"] = response.code == 400",
38303829
"",
38313830
"tests[\"success is false\"] = response.success == false",
3832-
"tests[\"Message is correct\"] = response.error.message == \"Cannot unlike yourself\"",
3831+
"tests[\"Message is correct\"] = response.error.message == \"Cannot unlike yourself.\"",
38333832
"tests[\"Error type is Bad Request\"] = response.error.type == \"BadRequestError\""
38343833
],
38353834
"type": "text/javascript"
@@ -3910,7 +3909,7 @@
39103909
"tests[\"JSON return code is 400\"] = response.code == 400",
39113910
"",
39123911
"tests[\"success is false\"] = response.success == false",
3913-
"tests[\"message is ok\"] = response.error.message == \"You never liked this person in the first place\""
3912+
"tests[\"message is ok\"] = response.error.message == \"You never liked this person in the first place.\""
39143913
],
39153914
"type": "text/javascript"
39163915
}
@@ -4188,7 +4187,7 @@
41884187
"tests[\"JSON return code is 404\"] = response.code == 404",
41894188
"",
41904189
"tests[\"success is false\"] = response.success == false",
4191-
"tests[\"Message is correct\"] = response.error.message == \"Recipient -1 not found\"",
4190+
"tests[\"Message is correct\"] = response.error.message == \"Recipient -1 not found.\"",
41924191
"tests[\"Error type is Bad Request\"] = response.error.type == \"NotFoundError\""
41934192
],
41944193
"type": "text/javascript"
@@ -4555,7 +4554,7 @@
45554554
"tests[\"JSON return code is 404\"] = response.code == 404",
45564555
"",
45574556
"tests[\"success is false\"] = response.success == false",
4558-
"tests[\"Message is correct\"] = response.error.message == \"With user -1 not found\"",
4557+
"tests[\"Message is correct\"] = response.error.message == \"With user -1 not found.\"",
45594558
"tests[\"Error type is Bad Request\"] = response.error.type == \"NotFoundError\""
45604559
],
45614560
"type": "text/javascript"
@@ -5596,92 +5595,92 @@
55965595
],
55975596
"variable": [
55985597
{
5599-
"id": "3e3e4438-8401-4003-abcf-5d074c05f462",
5598+
"id": "461c4e89-379c-4ecc-ab3d-e9a9ac5df859",
56005599
"key": "host",
56015600
"value": "http://127.0.0.1:5000"
56025601
},
56035602
{
5604-
"id": "474531ad-c989-4d92-8542-337ce9b010e1",
5603+
"id": "b70cbb5c-c6d1-4a86-8001-5b11d2a86ebc",
56055604
"key": "user_id",
56065605
"value": ""
56075606
},
56085607
{
5609-
"id": "072156e0-a96d-451f-abf8-f77280d4ffda",
5608+
"id": "0b2b9986-ac92-4be7-9971-8c6cff053764",
56105609
"key": "user_email",
56115610
"value": "foo@example.org"
56125611
},
56135612
{
5614-
"id": "3f4e4d49-011e-453c-9117-b0a38d6adcb3",
5613+
"id": "a582fcb5-db29-4339-8734-d4c842f859a4",
56155614
"key": "user_username",
56165615
"value": "foo"
56175616
},
56185617
{
5619-
"id": "e9a11cb6-74ce-42a5-8450-47fd021358e8",
5618+
"id": "c90dc190-68cc-42dd-b3f7-79b25c8097bd",
56205619
"key": "user_password",
56215620
"value": "admin"
56225621
},
56235622
{
5624-
"id": "1075fff5-b05b-4050-922d-00549dd85896",
5623+
"id": "c94d4c0a-5eb8-40aa-bfda-81b1af3edf17",
56255624
"key": "user_firstname",
56265625
"value": "Foo"
56275626
},
56285627
{
5629-
"id": "f792f8dc-f93f-422d-af8e-aadf547442a3",
5628+
"id": "afde1579-3438-45dd-b7fc-063b6baa7d07",
56305629
"key": "user_lastname",
56315630
"value": "Bar"
56325631
},
56335632
{
5634-
"id": "9b71ed57-93df-404e-baf0-35ec160bf68d",
5633+
"id": "418dab0a-b2b3-4a6a-82c3-50f1ae99d548",
56355634
"key": "debug_token",
56365635
"value": "xX69jules69Xx"
56375636
},
56385637
{
5639-
"id": "da9ec2ea-a081-49e1-862b-95b0dc2b2bb7",
5638+
"id": "ce3f5bd7-c5d7-4d36-8b69-58fbb34c99cc",
56405639
"key": "user_access_token",
56415640
"value": ""
56425641
},
56435642
{
5644-
"id": "66dd29f6-acb0-4886-8391-b0c6f20d3956",
5643+
"id": "00529b58-2d48-49ef-b100-5717853dad2b",
56455644
"key": "user_refresh_token",
56465645
"value": ""
56475646
},
56485647
{
5649-
"id": "d6e6a5c5-4d70-465c-8d89-b8845a7a6d20",
5648+
"id": "2b58f894-ab87-46e9-a36f-e333381e9eb2",
56505649
"key": "expired_token",
56515650
"value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTAyNDIyNjQsIm5iZiI6MTU5MDI0MjI2NCwianRpIjoiNTM0ZGI5NzQtOWE4Ni00MGViLWE1NDEtMDg3N2ZmNzQ3NDVhIiwiZXhwIjoxNTkwMjQyMzI0LCJpZGVudGl0eSI6eyJpZCI6NTEyLCJlbWFpbCI6ImZvb0BleGFtcGxlLm9yZyIsInVzZXJuYW1lIjoiYmFyIiwiaXNfb25saW5lIjp0cnVlLCJkYXRlX2xhc3RzZWVuIjoiU2F0LCAyMyBNYXkgMjAyMCAxMzo1Nzo0NCBHTVQifSwiZnJlc2giOnRydWUsInR5cGUiOiJhY2Nlc3MifQ.NTp2P0WNkXDwzuzrcNIQdeAfizQ57HQgkzBLSvY1yHU"
56525651
},
56535652
{
5654-
"id": "e7b3105e-0c77-41bf-9444-d83010cb5edf",
5653+
"id": "7712423f-6e0e-4634-aee6-e6dde0b5a424",
56555654
"key": "user_orientation",
56565655
"value": "heterosexual"
56575656
},
56585657
{
5659-
"id": "35bff664-ee13-4ad1-84b8-ceec64e1115f",
5658+
"id": "b77f31fc-c749-418b-acfd-4387628b9d57",
56605659
"key": "user_bio",
56615660
"value": "Lorem Ipsum is the single greatest threat. We are not - we are not keeping up with other websites. Lorem Ipsum best not make any more threats to your website. It will be met with fire and fury like the world has never seen. Does everybody know that pig named Lorem Ipsum? An ‘extremely credible source’ has called my office and told me that Barack Obama’s placeholder text is a fraud."
56625661
},
56635662
{
5664-
"id": "7dc06bee-b732-42b7-9323-d00a15906a34",
5663+
"id": "ae2a77eb-02ee-4439-a20b-023432b7ea16",
56655664
"key": "user_gender",
56665665
"value": "male"
56675666
},
56685667
{
5669-
"id": "070c3cca-ff6a-48da-8adc-aef32fc0ef32",
5668+
"id": "273e5cdc-2313-4b17-a26c-f5f0a3207f30",
56705669
"key": "user_birthdate",
56715670
"value": "06/04/1998"
56725671
},
56735672
{
5674-
"id": "1f84e84c-4b02-4fa9-8e80-21988282ee29",
5673+
"id": "9942a431-5645-43b4-9e85-497d3b85be3e",
56755674
"key": "user_lat",
56765675
"value": "44.8404"
56775676
},
56785677
{
5679-
"id": "bc34d6a4-ca83-4f7a-b3de-e62290c1084d",
5678+
"id": "ead5923f-2d1b-4753-9df3-7ddd9b8e721a",
56805679
"key": "user_lng",
56815680
"value": "-0.5805"
56825681
},
56835682
{
5684-
"id": "51ec8aee-c8a3-4bae-8fdb-b40aba5dabad",
5683+
"id": "4a54ddd0-4170-429b-9123-1b7aa11ba636",
56855684
"key": "user_ip",
56865685
"value": "77.205.46.181"
56875686
}

backend/PyMatcha/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
for item in REQUIRED_ENV_VARS:
5656
if item not in os.environ:
57-
raise EnvironmentError(f"{item} is not set in the server's environment or .env file. It is required")
57+
raise EnvironmentError(f"{item} is not set in the server's environment or .env file. It is required.")
5858

5959
if os.getenv("ENABLE_LOGGING") == "True":
6060
setup_logging()

backend/PyMatcha/models/user.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def create(
9090
pass
9191
else:
9292
logging.error("Email {} taken".format(email))
93-
raise ConflictError("Email {} taken".format(email), "Use another email")
93+
raise ConflictError("Email {} taken.".format(email), "Use another email.")
9494

9595
# Check username availability
9696
try:
@@ -99,20 +99,20 @@ def create(
9999
pass
100100
else:
101101
logging.error("Username {} taken".format(username))
102-
raise ConflictError("Username {} taken".format(username), "Try another username")
102+
raise ConflictError("Username {} taken.".format(username), "Try another username.")
103103

104104
# Check correct gender
105105
if gender not in ["male", "female", "other"]:
106106
logging.error("Gender must be male, female or other, not {}".format(gender))
107-
raise ConflictError("Gender must be male, female or other, not {}".format(gender))
107+
raise ConflictError("Gender must be male, female or other, not {}.".format(gender))
108108

109109
# Check correct orientation
110110
if orientation not in ["heterosexual", "homosexual", "bisexual", "other"]:
111111
logging.error(
112-
"Sexual Orientation must be heterosexual, homosexual, bisexual or other, not {}".format(orientation)
112+
"Sexual Orientation must be heterosexual, homosexual, bisexual or other, not {}.".format(orientation)
113113
)
114114
raise ConflictError(
115-
"Sexual Orientation must be heterosexual, homosexual, bisexual or other, not {}".format(orientation)
115+
"Sexual Orientation must be heterosexual, homosexual, bisexual or other, not {}.".format(orientation)
116116
)
117117

118118
# Check correct geohash
@@ -158,7 +158,7 @@ def register(email: str, username: str, password: str, first_name: str, last_nam
158158
pass
159159
else:
160160
logging.debug("Email {} taken".format(email))
161-
raise ConflictError("Email {} taken".format(email), "Use another email")
161+
raise ConflictError("Email {} taken.".format(email), "Use another email.")
162162

163163
# Check username availability
164164
try:
@@ -167,7 +167,7 @@ def register(email: str, username: str, password: str, first_name: str, last_nam
167167
pass
168168
else:
169169
logging.error("Username {} taken".format(username))
170-
raise ConflictError("Username {} taken".format(username), "Try another username")
170+
raise ConflictError("Username {} taken.".format(username), "Try another username.")
171171

172172
# Encrypt password
173173
password = hash_password(password)

backend/PyMatcha/routes/api/auth/login.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ def auth_login():
5555
u = get_user(username)
5656
except NotFoundError:
5757
current_app.logger.debug("/auth/login -> User not found")
58-
raise UnauthorizedError("Incorrect username or password")
58+
raise UnauthorizedError("Incorrect username or password.")
5959
if not check_password(u.password, password):
6060
current_app.logger.debug("/auth/login -> Password invalid")
61-
raise UnauthorizedError("Incorrect username or password")
61+
raise UnauthorizedError("Incorrect username or password.")
6262

6363
if not u.is_confirmed:
6464
current_app.logger.debug("/auth/login -> User is trying to login unconfirmed")
65-
raise UnauthorizedError("User needs to be confirmed first.", "Try again when you have confirmed your email")
65+
raise UnauthorizedError("User needs to be confirmed first.", "Try again when you have confirmed your email.")
6666
access_token = create_access_token(identity=u.get_jwt_info(), fresh=True)
6767
refresh_token = create_refresh_token(identity=u.get_jwt_info())
6868
access_jti = get_jti(access_token)

backend/PyMatcha/routes/api/auth/password.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,17 @@ def reset_password():
8282
else:
8383
if token_type != "reset":
8484
current_app.logger.debug("/auth/password/reset -> Wrong token type")
85-
raise BadRequestError("Wrong token type")
85+
raise BadRequestError("Wrong token type.")
8686
try:
8787
u = get_user(email)
8888
except NotFoundError:
8989
current_app.logger.debug("/auth/password/reset -> User not found")
90-
raise NotFoundError("User not found")
90+
raise NotFoundError("User not found.")
9191
if u.previous_reset_token == data["token"]:
9292
current_app.logger.debug("/auth/password/reset -> Token already used")
93-
raise BadRequestError("Token already used", "Please request a new one")
93+
raise BadRequestError("Token already used", "Please request a new one.")
9494
u.password = hash_password(data["password"])
9595
u.previous_reset_token = data["token"]
9696
u.save()
9797
current_app.logger.debug("/auth/password/reset -> Password reset successfully")
98-
return Success("Password reset successful")
98+
return Success("Password reset successful.")

backend/PyMatcha/routes/api/like.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ def like_profile(uid):
1818
try:
1919
u = get_user(uid)
2020
except NotFoundError:
21-
raise NotFoundError(f"User {uid} not found")
21+
raise NotFoundError(f"User {uid} not found.")
2222
if current_user.id == u.id:
23-
raise BadRequestError("Cannot like yourself")
23+
raise BadRequestError("Cannot like yourself.")
2424
if current_user.already_likes(u.id):
25-
raise BadRequestError("You already liked this person")
25+
raise BadRequestError("You already liked this person.")
2626
Like.create(liker_id=current_user.id, liked_id=u.id)
2727

2828
if u.already_likes(current_user.id):
@@ -38,11 +38,11 @@ def unlike_profile(uid):
3838
try:
3939
u = get_user(uid)
4040
except NotFoundError:
41-
raise NotFoundError(f"User {uid} not found")
41+
raise NotFoundError(f"User {uid} not found.")
4242
if current_user.id == u.id:
43-
raise BadRequestError("Cannot unlike yourself")
43+
raise BadRequestError("Cannot unlike yourself.")
4444
if not current_user.already_likes(u.id):
45-
raise BadRequestError("You never liked this person in the first place")
45+
raise BadRequestError("You never liked this person in the first place.")
4646
Like.get_multi(liked_id=u.id, liker_id=current_user.id).delete()
4747
return Success(f"Unliked user {u.id}.")
4848

0 commit comments

Comments
 (0)