Skip to content

Commit

Permalink
initialize test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilOrv committed Apr 1, 2025
1 parent dfec7ea commit 9b11582
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions backend/tests/TestExerciseSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def setUp(self):
self.user = get_user_model().objects.create_user(username="testuser", password="password")
self.client.force_authenticate(self.user)

def test_create_workout_valid(self): #
def test_exercise_set_min_minus(self): #
response = self.client.post("/api/workouts/", {
"name": "Morning Run",
"date": now().isoformat(),
Expand All @@ -27,7 +27,43 @@ def test_create_workout_valid(self): #
assert response.status_code == 201
assert Workout.objects.count() == 1

def test_create_workout_invalid_date(self): #
def test_exercise_set_min_plus(self): #
response = self.client.post("/api/workouts/", {
"name": "Invalid Run",
"date": "invalid_date",
"notes": "Wrong format",
"visibility": "PU", # Adding required field
"owner": self.user.id, # Adding required field
"exercise_instances": [] # Adding required field
}, format="json")

assert response.status_code == 400 # Should return validation error

def test_exercise_set_nom(self): #
response = self.client.post("/api/workouts/", {
"name": "Invalid Run",
"date": "invalid_date",
"notes": "Wrong format",
"visibility": "PU", # Adding required field
"owner": self.user.id, # Adding required field
"exercise_instances": [] # Adding required field
}, format="json")

assert response.status_code == 400 # Should return validation error

def test_exercise_set_max_minus(self): #
response = self.client.post("/api/workouts/", {
"name": "Invalid Run",
"date": "invalid_date",
"notes": "Wrong format",
"visibility": "PU", # Adding required field
"owner": self.user.id, # Adding required field
"exercise_instances": [] # Adding required field
}, format="json")

assert response.status_code == 400 # Should return validation error

def test_exercise_set_max_plus(self): #
response = self.client.post("/api/workouts/", {
"name": "Invalid Run",
"date": "invalid_date",
Expand Down

0 comments on commit 9b11582

Please sign in to comment.