Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
SMASCH
scheduling-system
Commits
1bf67329
Commit
1bf67329
authored
4 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
added test without permissions. fixed other tests
parent
2a7dcd3f
No related branches found
No related tags found
1 merge request
!268
Resolve "Permission and button to unfinish visit or to add appointment."
Pipeline
#34058
failed
4 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/tests/view/test_visit.py
+24
-0
24 additions, 0 deletions
smash/web/tests/view/test_visit.py
with
24 additions
and
0 deletions
smash/web/tests/view/test_visit.py
+
24
−
0
View file @
1bf67329
...
...
@@ -101,7 +101,28 @@ class VisitViewTests(LoggedInTestCase):
self
.
assertTrue
(
new_visit
.
is_finished
)
self
.
assertEqual
(
2
,
Visit
.
objects
.
count
())
def
test_unfinish_visit_without_permissions
(
self
):
visit
=
create_visit
()
self
.
assertFalse
(
visit
.
is_finished
)
response
=
self
.
client
.
get
(
reverse
(
'
web.views.visit_mark
'
,
args
=
[
visit
.
id
,
"
finished
"
]))
self
.
assertEqual
(
response
.
status_code
,
302
)
new_visit
=
Visit
.
objects
.
get
(
id
=
visit
.
id
)
self
.
assertTrue
(
new_visit
.
is_finished
)
self
.
assertEqual
(
2
,
Visit
.
objects
.
count
())
response
=
self
.
client
.
get
(
reverse
(
'
web.views.visit_unfinish
'
,
args
=
[
visit
.
id
]),
follow
=
True
)
messages
=
list
(
get_messages
(
response
.
wsgi_request
))
self
.
assertEqual
(
len
(
messages
),
1
)
self
.
assertEqual
(
str
(
messages
[
0
]),
'
You are not authorized to view this page or perform this action. Request permissions to the system administrator.
'
)
new_visit
=
Visit
.
objects
.
get
(
id
=
visit
.
id
)
self
.
assertEqual
(
2
,
Visit
.
objects
.
count
())
self
.
assertTrue
(
new_visit
.
is_finished
)
def
test_unfinish_visit_with_future_visit_without_appointments
(
self
):
self
.
login_as_admin
()
visit
=
create_visit
()
self
.
assertFalse
(
visit
.
is_finished
)
...
...
@@ -122,6 +143,7 @@ class VisitViewTests(LoggedInTestCase):
self
.
assertFalse
(
new_visit
.
is_finished
)
def
test_unfinish_visit_with_future_visit_with_appointments
(
self
):
self
.
login_as_admin
()
visit
=
create_visit
()
self
.
assertFalse
(
visit
.
is_finished
)
...
...
@@ -143,6 +165,7 @@ class VisitViewTests(LoggedInTestCase):
self
.
assertTrue
(
original_visit
.
is_finished
)
def
test_unfinish_visit_with_two_future_visits
(
self
):
self
.
login_as_admin
()
visit
=
create_visit
()
self
.
assertFalse
(
visit
.
is_finished
)
response
=
self
.
client
.
get
(
reverse
(
'
web.views.visit_mark
'
,
args
=
[
visit
.
id
,
"
finished
"
]))
...
...
@@ -169,6 +192,7 @@ class VisitViewTests(LoggedInTestCase):
self
.
assertTrue
(
original_visit
.
is_finished
)
def
test_unfinish_visit_which_is_not_finished
(
self
):
self
.
login_as_admin
()
visit
=
create_visit
()
self
.
assertFalse
(
visit
.
is_finished
)
...
...
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