Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tdt4242-base
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
Rolf Erik Sesseng Aas
tdt4242-base
Commits
89a526a0
Commit
89a526a0
authored
4 years ago
by
KreizerHgz
Browse files
Options
Downloads
Patches
Plain Diff
meh
parent
fcfc132b
No related branches found
No related tags found
2 merge requests
!7
Develop
,
!5
Tests for task 2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/secfit/users/tests.py
+6
-0
6 additions, 0 deletions
backend/secfit/users/tests.py
backend/secfit/workouts/tests.py
+33
-0
33 additions, 0 deletions
backend/secfit/workouts/tests.py
with
39 additions
and
0 deletions
backend/secfit/users/tests.py
+
6
−
0
View file @
89a526a0
from
django.test
import
TestCase
# Create your tests here.
class
Test
(
TestCase
):
def
test
(
self
):
assert
True
This diff is collapsed.
Click to expand it.
backend/secfit/workouts/tests.py
+
33
−
0
View file @
89a526a0
"""
Tests for the workouts application.
"""
from
workouts.permissions
import
IsOwner
from
workouts.models
import
Exercise
,
Workout
from
unittest.mock
import
MagicMock
from
django.test
import
TestCase
import
datetime
# Create your tests here.
class
TestIsOwner
(
TestCase
):
def
setUp
(
self
):
self
.
permission
=
IsOwner
()
self
.
view
=
MagicMock
()
self
.
user
=
MagicMock
(
phone_number
=
'
10101010
'
,
country
=
'
Lorem
'
,
city
=
'
Ipsum
'
,
street_address
=
'
LIRoad 3
'
)
self
.
request
=
MagicMock
(
user
=
self
.
user
)
self
.
ex
=
Exercise
.
objects
.
create
(
name
=
'
Lift
'
,
description
=
'
What do you think lift means?
'
,
unit
=
'
kg
'
)
self
.
wo
=
Workout
.
objects
.
create
(
name
=
'
WOD
'
,
date
=
datetime
.
datetime
.
now
(),
notes
=
'
WOD means Workout Of the Day
'
,
owner
=
self
.
user
,
visibility
=
'
PU
'
)
def
test_is_owner
(
self
):
assert
(
self
.
permission
.
has_object_permission
(
self
.
request
,
self
.
view
,
self
.
wo
))
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