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
e5b4944d
Commit
e5b4944d
authored
1 year ago
by
Benjamin Hättasch
Browse files
Options
Downloads
Patches
Plain Diff
Document test cases for AKDashboard
parent
aefea4fd
No related branches found
Branches containing commit
No related tags found
1 merge request
!179
Code quality improvements
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AKDashboard/tests.py
+36
-0
36 additions, 0 deletions
AKDashboard/tests.py
with
36 additions
and
0 deletions
AKDashboard/tests.py
+
36
−
0
View file @
e5b4944d
...
...
@@ -10,8 +10,14 @@ from AKModel.tests import BasicViewTests
class
DashboardTests
(
TestCase
):
"""
Specific Dashboard Tests
"""
@classmethod
def
setUpTestData
(
cls
):
"""
Initialize Test database
"""
super
().
setUpTestData
()
cls
.
event
=
Event
.
objects
.
create
(
name
=
"
Dashboard Test Event
"
,
...
...
@@ -28,17 +34,30 @@ class DashboardTests(TestCase):
)
def
test_dashboard_view
(
self
):
"""
Check that the main dashboard is reachable
(would also be covered by generic view testcase below)
"""
url
=
reverse
(
'
dashboard:dashboard_event
'
,
kwargs
=
{
"
slug
"
:
self
.
event
.
slug
})
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_nonexistent_dashboard_view
(
self
):
"""
Make sure there is no dashboard for an non-existing event
"""
url
=
reverse
(
'
dashboard:dashboard_event
'
,
kwargs
=
{
"
slug
"
:
"
nonexistent-event
"
})
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
404
)
@override_settings
(
DASHBOARD_SHOW_RECENT
=
True
)
def
test_history
(
self
):
"""
Test displaying of history
For the sake of that test, the setting to show recent events in dashboard is enforced to be true
regardless of the default configuration currently in place
"""
url
=
reverse
(
'
dashboard:dashboard_event
'
,
kwargs
=
{
"
slug
"
:
self
.
event
.
slug
})
# History should be empty
...
...
@@ -57,6 +76,11 @@ class DashboardTests(TestCase):
self
.
assertEqual
(
response
.
context
[
"
recent_changes
"
][
0
][
'
text
'
],
"
New AK: Test AK.
"
)
def
test_public
(
self
):
"""
Test handling of public and private events
(only public events should be part of the standard dashboard,
but there should be an individual dashboard for both public and private events)
"""
url_dashboard_index
=
reverse
(
'
dashboard:dashboard
'
)
url_event_dashboard
=
reverse
(
'
dashboard:dashboard_event
'
,
kwargs
=
{
"
slug
"
:
self
.
event
.
slug
})
...
...
@@ -79,6 +103,9 @@ class DashboardTests(TestCase):
self
.
assertTrue
(
self
.
event
in
response
.
context
[
"
events
"
])
def
test_active
(
self
):
"""
Test existence of buttons with regard to activity status of the given event
"""
url_event_dashboard
=
reverse
(
'
dashboard:dashboard_event
'
,
kwargs
=
{
"
slug
"
:
self
.
event
.
slug
})
if
apps
.
is_installed
(
'
AKSubmission
'
):
...
...
@@ -95,6 +122,9 @@ class DashboardTests(TestCase):
self
.
assertContains
(
response
,
"
AK Submission
"
)
def
test_plan_hidden
(
self
):
"""
Test visibility of plan buttons with regard to plan visibility status for a given event
"""
url_event_dashboard
=
reverse
(
'
dashboard:dashboard_event
'
,
kwargs
=
{
"
slug
"
:
self
.
event
.
slug
})
if
apps
.
is_installed
(
'
AKPlan
'
):
...
...
@@ -114,6 +144,9 @@ class DashboardTests(TestCase):
self
.
assertContains
(
response
,
"
AK Wall
"
)
def
test_dashboard_buttons
(
self
):
"""
Make sure manually added buttons are displayed correctly
"""
url_event_dashboard
=
reverse
(
'
dashboard:dashboard_event
'
,
kwargs
=
{
"
slug
"
:
self
.
event
.
slug
})
response
=
self
.
client
.
get
(
url_event_dashboard
)
...
...
@@ -129,6 +162,9 @@ class DashboardTests(TestCase):
class
DashboardViewTests
(
BasicViewTests
,
TestCase
):
"""
Generic view tests, based on :class:`AKModel.BasicViewTests` as specified in this class in VIEWS
"""
fixtures
=
[
'
model.json
'
,
'
dashboard.json
'
]
APP_NAME
=
'
dashboard
'
...
...
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