Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TDT4242-group15
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vegard Murvold Sporstøl
TDT4242-group15
Commits
7d1fc7e0
Commit
7d1fc7e0
authored
4 years ago
by
Vegard Murvold Sporstøl
Browse files
Options
Downloads
Patches
Plain Diff
add all needed tests
parent
1e96df7c
No related branches found
Branches containing commit
No related tags found
1 merge request
!7
Task3
Pipeline
#113588
passed
4 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/secfit/users/tests.py
+15
-1
15 additions, 1 deletion
backend/secfit/users/tests.py
backend/secfit/workouts/tests.py
+41
-4
41 additions, 4 deletions
backend/secfit/workouts/tests.py
with
56 additions
and
5 deletions
backend/secfit/users/tests.py
+
15
−
1
View file @
7d1fc7e0
...
...
@@ -11,8 +11,8 @@ from users.models import User
from
django.test
import
TestCase
# Tests new registration, boundary values and 2-way domain
class
RegistrationTestCase
(
APITestCase
):
def
test_registration
(
self
):
data
=
{
"
username
"
:
"
testcase
"
,
"
email
"
:
"
test@test.no
"
,
"
password
"
:
"
strong_pwd
"
,
"
password1
"
:
"
strong_pwd
"
,
...
...
@@ -21,3 +21,17 @@ class RegistrationTestCase(APITestCase):
response
=
self
.
client
.
post
(
"
/api/users/
"
,
data
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
def
test_boundaryValuesOfRegistration
(
self
):
"
Test boudary values of signup
"
def
test_domainRegistration
(
self
):
"
2-way domain tests to test the register page
"
# Tests new functionality in UC-2
class
Statistics
(
APITestCase
):
def
test_renderStatistics
(
self
):
"
test that the statistics are rendered
"
def
test_correctStatistics
(
self
):
"
Check that statistics are correctly calculated
"
This diff is collapsed.
Click to expand it.
backend/secfit/workouts/tests.py
+
41
−
4
View file @
7d1fc7e0
"""
Tests for the workouts application.
"""
import
json
from
django.contrib.auth.models
import
User
from
django.urls
import
reverse
from
rest_framework
import
status
from
rest_framework.authtoken.models
import
Token
from
rest_framework.test
import
APITestCase
from
users.serializers
import
UserSerializer
from
users.models
import
User
from
django.test
import
TestCase
# Create your tests here.
class
NewWorkoutTestCase
(
APITestCase
):
def
test_newWorkoutRegistration
(
self
):
"
Test registering a new workout
"
def
test_boundaryValuesOfNewWorkout
(
self
):
"
test boundary values of new workout
"
class
WorkoutDetails
(
APITestCase
):
def
test_viewDetails
(
self
):
"
Test that user can view all details
"
def
test_viewFiles
(
self
):
"
Test that user can view all files
"
def
test_viewComments
(
self
):
"
Test that user can view all comments
"
class
Categories
(
APITestCase
):
def
test_categorizeExercise
(
self
):
"
test that categorizing exercise works
"
def
test_sortExercise
(
self
):
"
test that sorting exercise works
"
class
NewWorkoutAsCoach
(
APITestCase
):
def
test_createWorkoutAsCoach
(
self
):
"
Check that a workout can be created as a coach
"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment