Commit 15b4cb68 authored by Morten Nordseth's avatar Morten Nordseth
Browse files

smell - bad name convention

parent 7906b404
Pipeline #128368 failed with stages
......@@ -50,12 +50,12 @@ class WorkoutPermissionTest(TestCase):
"id": self.exerciseInstance["id"], "sets": "1", "number": "1"
}], "date": "2021-03-05T10:34:00Z"}, content_type="application/json"
).content.decode("UTF-8"))
def testIsOwner(self):
def test_is_owner(self):
workoutId = self.workout["id"]
self.assertEqual(self.authenticatedClient1.get(f"/api/workouts/{workoutId}/").status_code, 200)
self.assertEqual(self.authenticatedClient2.get(f"/api/workouts/{workoutId}/").status_code, 403)
def testIsOwnerOfWorkout(self):
def test_is_owner_of_workout(self):
publicWorkout = json.loads(
self.authenticatedClient1.post("/api/workouts/",
{"name": "Extreme sit-up workout V2", "notes": "hello notes",
......@@ -95,7 +95,7 @@ class WorkoutPermissionTest(TestCase):
file.seek(0)
return file
def testIsWorkoutPublic(self):
def test_is_workout_public(self):
publicWorkout = json.loads(
self.authenticatedClient1.post("/api/workouts/",
{"name": "Extreme sit-up workout V2", "notes": "hello notes",
......@@ -120,7 +120,7 @@ class WorkoutPermissionTest(TestCase):
def testIsPublic(self):
def test_is_public(self):
#create object with workout that is public
publicWorkout = json.loads(
self.authenticatedClient1.post("/api/workouts/",
......@@ -149,7 +149,7 @@ class WorkoutPermissionTest(TestCase):
self.assertEqual(self.authenticatedClient2.get(f"/api/workouts/{privateWorkout['id']}/").status_code, 403)
# 200 = ok, 405 = not allowed, 403 = du har itj lov
def testIsReadOnly(self):
def test_is_read_only(self):
publicWorkout = json.loads(
self.authenticatedClient1.post("/api/workouts/",
{"name": "Extreme sit-up workout V2", "notes": "hello notes",
......@@ -205,7 +205,7 @@ class WorkoutPermissionTest(TestCase):
self.authenticatedClient2.head(f"/api/workouts/{publicWorkout['id']}/").status_code, 200)
def testIsCoachAndVisibleToCoach(self):
def test_is_coach_and_visible_to_coach(self):
user2Revised = {"username": "user", "password": "user", "password1": "user", "phone_number": 21321321,
"email": f"user@user.user", "country": "", "city": "", "street_address": "", "coach": self.user1['url'], "athletes": []}
self.authenticatedClient2.patch(f"/api/users/{self.user2['id']}/", json.dumps(user2Revised), content_type="application/json")
......@@ -224,7 +224,7 @@ class WorkoutPermissionTest(TestCase):
def testIsCoachOfWorkoutAndVisibleToCoach(self):
def test_is_coach_of_workout_and_visible_to_coach(self):
user3Revised = { "coach": self.user2['url']}
self.authenticatedClient3.patch(f"/api/users/{self.user3['id']}/", json.dumps(user3Revised),
content_type="application/json")
......@@ -242,7 +242,7 @@ class WorkoutPermissionTest(TestCase):
if os.path.exists("test.png"):
os.remove("test.png")
def testFavorites(self):
def test_favorites(self):
#Test GET
favorites = json.loads(self.authenticatedClient1.get("/api/favorites/").content.decode("UTF-8"))["results"]
self.assertEqual(len(favorites), 0)
......@@ -268,7 +268,7 @@ class WorkoutPermissionTest(TestCase):
favoritesAfterDelete = json.loads(self.authenticatedClient1.get("/api/favorites/").content.decode("UTF-8"))["results"]
self.assertFalse(len(favorites) == len(favoritesAfterDelete))
def testFavoritesRobustness(self):
def test_favorites_robustness(self):
# Missing data
favoriteData = {"user": self.user1["id"]}
response = self.authenticatedClient1.post("/api/favorites/", favoriteData)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment