Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AKPlanning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
KIF
AKPlanning
Commits
26db4d00
Commit
26db4d00
authored
2 years ago
by
Benjamin Hättasch
Browse files
Options
Downloads
Patches
Plain Diff
Implement minor improvement for testing framework & add two more tests
parent
216e2bd1
No related branches found
Branches containing commit
No related tags found
1 merge request
!152
Allow creating and setting a previously unknown owner from AK editing form
Pipeline
#128846
passed
2 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
AKModel/tests.py
+10
-3
10 additions, 3 deletions
AKModel/tests.py
AKPlan/tests.py
+8
-0
8 additions, 0 deletions
AKPlan/tests.py
with
18 additions
and
3 deletions
AKModel/tests.py
+
10
−
3
View file @
26db4d00
import
traceback
from
typing
import
List
from
typing
import
List
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
...
@@ -59,8 +60,11 @@ class BasicViewTests:
...
@@ -59,8 +60,11 @@ class BasicViewTests:
def
test_views_for_200
(
self
):
def
test_views_for_200
(
self
):
for
view_name
in
self
.
VIEWS
:
for
view_name
in
self
.
VIEWS
:
view_name_with_prefix
,
url
=
self
.
_name_and_url
(
view_name
)
view_name_with_prefix
,
url
=
self
.
_name_and_url
(
view_name
)
response
=
self
.
client
.
get
(
url
)
try
:
self
.
assertEqual
(
response
.
status_code
,
200
,
msg
=
f
"
{
view_name_with_prefix
}
(
{
url
}
) broken
"
)
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
200
,
msg
=
f
"
{
view_name_with_prefix
}
(
{
url
}
) broken
"
)
except
Exception
as
e
:
self
.
fail
(
f
"
An error occurred during rendering of
{
view_name_with_prefix
}
(
{
url
}
):
\n\n
{
traceback
.
format_exc
()
}
"
)
def
test_access_control_staff_only
(
self
):
def
test_access_control_staff_only
(
self
):
self
.
client
.
logout
()
self
.
client
.
logout
()
...
@@ -94,9 +98,12 @@ class ModelViewTests(BasicViewTests, TestCase):
...
@@ -94,9 +98,12 @@ class ModelViewTests(BasicViewTests, TestCase):
(
DefaultSlot
,
'
defaultslot
'
)
(
DefaultSlot
,
'
defaultslot
'
)
]
]
VIEWS_STAFF_ONLY
=
[
(
'
admin:index
'
,
{})
]
def
test_admin
(
self
):
def
test_admin
(
self
):
self
.
client
.
force_login
(
self
.
admin_user
)
self
.
client
.
force_login
(
self
.
admin_user
)
for
model
in
self
.
ADMIN_MODELS
:
for
model
in
self
.
ADMIN_MODELS
:
if
model
[
1
]
==
"
event
"
:
if
model
[
1
]
==
"
event
"
:
continue
continue
...
...
This diff is collapsed.
Click to expand it.
AKPlan/tests.py
+
8
−
0
View file @
26db4d00
...
@@ -26,3 +26,11 @@ class PlanViewTests(BasicViewTests, TestCase):
...
@@ -26,3 +26,11 @@ class PlanViewTests(BasicViewTests, TestCase):
response
=
self
.
client
.
get
(
url
)
response
=
self
.
client
.
get
(
url
)
self
.
assertNotContains
(
response
,
"
Plan is not visible (yet).
"
,
self
.
assertNotContains
(
response
,
"
Plan is not visible (yet).
"
,
msg_prefix
=
"
Plan is not visible for staff user
"
)
msg_prefix
=
"
Plan is not visible for staff user
"
)
def
test_wall_redirect
(
self
):
view_name_with_prefix
,
url_wall
=
self
.
_name_and_url
((
'
plan_wall
'
,
{
'
event_slug
'
:
'
kif23
'
}))
view_name_with_prefix
,
url_plan
=
self
.
_name_and_url
((
'
plan_overview
'
,
{
'
event_slug
'
:
'
kif23
'
}))
response
=
self
.
client
.
get
(
url_wall
)
self
.
assertRedirects
(
response
,
url_plan
,
msg_prefix
=
f
"
Redirect away from wall not working (
{
url_wall
}
->
{
url_plan
}
)
"
)
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