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
Merge requests
!95
Test cases
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Test cases
tests
into
main
Overview
0
Commits
3
Pipelines
8
Changes
2
Merged
Benjamin Hättasch
requested to merge
tests
into
main
3 years ago
Overview
0
Commits
3
Pipelines
8
Changes
2
Expand
Implement three basic testcases for AKDashboard
Edited
3 years ago
by
Benjamin Hättasch
0
0
Merge request reports
Compare
main
version 7
4c26e714
3 years ago
version 6
857cbc0d
3 years ago
version 5
f9e1af7b
3 years ago
version 4
8c62fba5
3 years ago
version 3
7418b956
3 years ago
version 2
92817f9e
3 years ago
version 1
bd8e16dd
3 years ago
main (base)
and
version 2
latest version
8b83f47b
3 commits,
3 years ago
version 7
4c26e714
3 commits,
3 years ago
version 6
857cbc0d
3 commits,
3 years ago
version 5
f9e1af7b
2 commits,
3 years ago
version 4
8c62fba5
2 commits,
3 years ago
version 3
7418b956
2 commits,
3 years ago
version 2
92817f9e
2 commits,
3 years ago
version 1
bd8e16dd
1 commit,
3 years ago
2 files
+
56
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
AKDashboard/tests.py
+
52
−
1
Options
# Create your tests here.
import
pytz
from
django.test
import
TestCase
from
django.urls
import
reverse
from
django.utils.timezone
import
now
from
AKModel.models
import
Event
,
AK
,
AKCategory
class
DashboardTests
(
TestCase
):
@classmethod
def
setUpTestData
(
cls
):
super
().
setUpTestData
()
cls
.
event
=
Event
.
objects
.
create
(
name
=
"
Test Event
"
,
slug
=
"
test
"
,
timezone
=
pytz
.
utc
,
start
=
now
(),
end
=
now
(),
active
=
True
,
)
cls
.
default_category
=
AKCategory
.
objects
.
create
(
name
=
"
Test Category
"
,
event
=
cls
.
event
,
)
def
test_dashboard_view
(
self
):
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
):
url
=
reverse
(
'
dashboard:dashboard_event
'
,
kwargs
=
{
"
slug
"
:
"
nonexistent-event
"
})
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
404
)
def
test_history
(
self
):
url
=
reverse
(
'
dashboard:dashboard_event
'
,
kwargs
=
{
"
slug
"
:
self
.
event
.
slug
})
# History should be empty
response
=
self
.
client
.
get
(
url
)
self
.
assertQuerysetEqual
(
response
.
context
[
"
recent_changes
"
],
[])
AK
.
objects
.
create
(
name
=
"
Test AK
"
,
category
=
self
.
default_category
,
event
=
self
.
event
,
)
# History should now contain one AK (Test AK)
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
len
(
response
.
context
[
"
recent_changes
"
]),
1
)
self
.
assertEqual
(
response
.
context
[
"
recent_changes
"
][
0
][
'
text
'
],
"
New AK: Test AK.
"
)
Loading