Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Andreas Rimolsrønning
tdt4242-base
Commits
27f18760
Commit
27f18760
authored
Apr 19, 2021
by
and
Browse files
Reset Docstrings For Tests
parent
53a79ed1
Pipeline
#129193
passed with stage
in 53 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
backend/secfit/tests/common.py
View file @
27f18760
...
...
@@ -14,6 +14,8 @@ webdriver_path = os.environ.get("WEBDRIVER", "chromedriver")
class
Visibility
(
str
,
enum
.
Enum
):
"""Enum representing workout visibility."""
PUBLIC
=
"PU"
COACH
=
"CO"
PRIVATE
=
"PR"
...
...
backend/secfit/tests/test_profile.py
View file @
27f18760
...
...
@@ -29,6 +29,7 @@ class ViewProfileTest(BlackBoxTestServer):
return
element
.
get_attribute
(
"value"
)
def
test_non_user_can_not_view_own_profile
(
self
):
"""Test if a user is able to view their own public workout."""
self
.
get
(
"profile.html"
)
self
.
assertEqual
(
"My Profile"
,
self
.
driver
.
title
)
self
.
wait_until_value_not_empty
(
By
.
ID
,
"username"
)
...
...
@@ -40,6 +41,7 @@ class ViewProfileTest(BlackBoxTestServer):
self
.
assertEqual
(
email
,
""
)
def
test_user_can_view_own_profile
(
self
):
"""Test if a user is able to view their own public workout."""
user
=
login_data
[
"athlete"
]
self
.
login
(
user
)
self
.
get
(
"profile.html"
)
...
...
backend/secfit/tests/test_view_workout.py
View file @
27f18760
...
...
@@ -52,6 +52,7 @@ class ViewWorkoutTest(BlackBoxTestServer):
return
element
.
get_attribute
(
"value"
)
def
test_user_can_view_own_public_workout
(
self
):
"""Test if a user is able to view their own public workout."""
user
=
login_data
[
"athlete"
]
self
.
login
(
user
)
self
.
get
(
"workout.html"
,
id
=
1
)
...
...
@@ -67,6 +68,7 @@ class ViewWorkoutTest(BlackBoxTestServer):
self
.
assertEqual
(
value
,
Visibility
.
PUBLIC
)
def
test_coach_can_view_athletes_workout
(
self
):
"""Test if a coach is able to view their athlete's workout."""
user
=
login_data
[
"coach"
]
self
.
login
(
user
)
self
.
get
(
"workout.html"
,
id
=
2
)
...
...
@@ -81,6 +83,7 @@ class ViewWorkoutTest(BlackBoxTestServer):
self
.
assertEqual
(
value
,
Visibility
.
COACH
)
def
test_user_can_view_others_public_workout
(
self
):
"""Test if a user is able to view another users' public workout."""
user
=
login_data
[
"athlete"
]
self
.
login
(
user
)
self
.
get
(
"workout.html"
,
id
=
3
)
...
...
@@ -95,6 +98,7 @@ class ViewWorkoutTest(BlackBoxTestServer):
self
.
assertEqual
(
value
,
Visibility
.
PUBLIC
)
def
test_user_can_view_own_private_workout
(
self
):
"""Test if a user is able to view their own private workout."""
user
=
login_data
[
"athlete"
]
self
.
login
(
user
)
self
.
get
(
"workout.html"
,
id
=
4
)
...
...
@@ -109,6 +113,7 @@ class ViewWorkoutTest(BlackBoxTestServer):
self
.
assertEqual
(
value
,
Visibility
.
PRIVATE
)
def
test_user_cannot_view_other_users_private_workout
(
self
):
"""Test if a user is unable to view another users' private workout."""
user
=
login_data
[
"coach"
]
self
.
login
(
user
)
self
.
get
(
"workout.html"
,
id
=
4
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment