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
d68fab4f
Commit
d68fab4f
authored
4 years ago
by
Vegard Murvold Sporstøl
Browse files
Options
Downloads
Patches
Plain Diff
add two-way domain test
parent
8d9cd113
Branches
UC-2
Branches containing commit
No related tags found
1 merge request
!7
Task3
Pipeline
#113941
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
+79
-10
79 additions, 10 deletions
backend/secfit/users/tests.py
backend/secfit/workouts/tests.py
+2
-2
2 additions, 2 deletions
backend/secfit/workouts/tests.py
with
81 additions
and
12 deletions
backend/secfit/users/tests.py
+
79
−
10
View file @
d68fab4f
...
...
@@ -58,16 +58,6 @@ class BoundaryValuesOfRegistrationTestCase(TestCase):
self
.
assertEqual
(
response
.
status_code
,
400
)
#should fail if email does not conatin @
### 2-way domain testing of registration ###
class
TwoWayDomainTestOfRegistrationTestCase
(
TestCase
):
def
setUp
(
self
):
self
.
client
=
Client
()
def
test_domainRegistration
(
self
):
"
2-way domain tests to test the register page
"
### Test the class UserSerializer ###
...
...
@@ -107,3 +97,82 @@ class UserSerializerTestCase(TestCase):
self
.
assertEqual
(
user
.
country
,
"
Norway
"
)
self
.
assertEqual
(
user
.
city
,
"
Trondheim
"
)
self
.
assertEqual
(
user
.
street_address
,
"
Trondheimsvegen 1
"
)
### 2-way domain testing of registration ###
test_cases
=
[
{
'
email
'
:
'
wrong
'
,
'
username
'
:
'
wrong
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
empty
'
,
'
city
'
:
'
empty
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
wrong
'
,
'
username
'
:
'
normal
'
,
'
password
'
:
'
empty
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
empty
'
},
{
'
email
'
:
'
wrong
'
,
'
username
'
:
'
empty
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
empty
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
empty
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
wrong
'
,
'
username
'
:
'
normal
'
,
'
password
'
:
'
empty
'
,
'
password1
'
:
'
empty
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
wrong
'
,
'
username
'
:
'
normal
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
empty
'
,
'
city
'
:
'
empty
'
,
'
street_address
'
:
'
empty
'
},
{
'
email
'
:
'
normal
'
,
'
username
'
:
'
wrong
'
,
'
password
'
:
'
empty
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
empty
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
normal
'
,
'
username
'
:
'
normal
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
empty
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
empty
'
},
{
'
email
'
:
'
normal
'
,
'
username
'
:
'
empty
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
empty
'
},
{
'
email
'
:
'
normal
'
,
'
username
'
:
'
wrong
'
,
'
password
'
:
'
empty
'
,
'
password1
'
:
'
empty
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
empty
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
empty
'
,
'
username
'
:
'
empty
'
,
'
password
'
:
'
empty
'
,
'
password1
'
:
'
empty
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
empty
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
empty
'
,
'
username
'
:
'
wrong
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
empty
'
},
{
'
email
'
:
'
empty
'
,
'
username
'
:
'
normal
'
,
'
password
'
:
'
empty
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
empty
'
,
'
city
'
:
'
empty
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
empty
'
,
'
username
'
:
'
normal
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
empty
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
empty
'
},
{
'
email
'
:
'
empty
'
,
'
username
'
:
'
empty
'
,
'
password
'
:
'
empty
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
empty
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
empty
'
,
'
username
'
:
'
wrong
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
empty
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
empty
'
,
'
street_address
'
:
'
empty
'
},
{
'
email
'
:
'
empty
'
,
'
username
'
:
'
normal
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
empty
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
wrong
'
,
'
username
'
:
'
wrong
'
,
'
password
'
:
'
empty
'
,
'
password1
'
:
'
empty
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
wrong
'
,
'
username
'
:
'
empty
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
empty
'
,
'
street_address
'
:
'
empty
'
},
{
'
email
'
:
'
wrong
'
,
'
username
'
:
'
wrong
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
empty
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
empty
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
wrong
'
,
'
username
'
:
'
empty
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
empty
'
,
'
city
'
:
'
empty
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
normal
'
,
'
username
'
:
'
normal
'
,
'
password
'
:
'
empty
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
empty
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
normal
'
,
'
username
'
:
'
normal
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
empty
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
empty
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
empty
'
},
{
'
email
'
:
'
normal
'
,
'
username
'
:
'
empty
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
empty
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
normal
'
,
'
username
'
:
'
wrong
'
,
'
password
'
:
'
empty
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
empty
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
empty
'
},
{
'
email
'
:
'
normal
'
,
'
username
'
:
'
normal
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
empty
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
empty
'
,
'
street_address
'
:
'
normal
'
},
{
'
email
'
:
'
normal
'
,
'
username
'
:
'
empty
'
,
'
password
'
:
'
empty
'
,
'
password1
'
:
'
normal
'
,
'
phone_number
'
:
'
empty
'
,
'
country
'
:
'
normal
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
empty
'
},
{
'
email
'
:
'
normal
'
,
'
username
'
:
'
wrong
'
,
'
password
'
:
'
normal
'
,
'
password1
'
:
'
empty
'
,
'
phone_number
'
:
'
normal
'
,
'
country
'
:
'
empty
'
,
'
city
'
:
'
normal
'
,
'
street_address
'
:
'
normal
'
}
]
case_data
=
{
'
normal
'
:
{
'
email
'
:
'
test@test.no
'
,
'
username
'
:
'
test
'
,
'
password
'
:
'
test123
'
,
'
password1
'
:
'
test123
'
,
'
phone_number
'
:
12354678
,
'
country
'
:
'
Norway
'
,
'
city
'
:
'
Trondheim
'
,
'
street_address
'
:
'
Trondheimsvegen
'
,
},
'
empty
'
:
{
'
email
'
:
''
,
'
username
'
:
''
,
'
password
'
:
''
,
'
password1
'
:
''
,
'
phone_number
'
:
''
,
'
country
'
:
''
,
'
city
'
:
''
,
'
street_address
'
:
''
,
},
'
wrong
'
:
{
'
email
'
:
'
test.no
'
,
'
username
'
:
'
test]
'
,
}
}
class
TwoWayDomainTestOfRegistrationTestCase
(
TestCase
):
def
setUp
(
self
):
self
.
client
=
Client
()
def
test_domainRegistration
(
self
):
for
case
in
test_cases
:
data
=
{}
for
key
,
value
in
case
.
items
():
data
[
key
]
=
case_data
[
value
][
key
]
code
=
201
if
case
[
'
email
'
]
==
'
wrong
'
or
case
[
'
username
'
]
==
'
wrong
'
or
case
[
'
password
'
]
==
'
empty
'
or
case
[
'
username
'
]
==
'
empty
'
or
case
[
'
password1
'
]
==
'
empty
'
:
code
=
400
response
=
self
.
client
.
post
(
'
/api/users/
'
,
data
)
self
.
assertEqual
(
response
.
status_code
,
code
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
backend/secfit/workouts/tests.py
+
2
−
2
View file @
d68fab4f
...
...
@@ -30,12 +30,12 @@ class NewWorkoutTestCase(TestCase):
self
.
client
.
defaults
[
'
HTTP_AUTHORIZATION
'
]
=
'
Bearer
'
+
content
[
'
access
'
]
def
test_newWorkoutRegistration
(
self
):
"""
response = self.client.post(
'
/api/workouts/
'
, {
'
name
'
:
'
test
'
,
'
date
'
:
'
2021-03-06T18:00:00Z
'
,
'
notes
'
:
'
note
'
,
'
owner
'
: self.user,
'
visibility
'
:
'
PU
'
})
self.assertEqual(response.status_code, 201)
"""
### Test boundary values of new workout ###
...
...
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