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
c98f0454
Commit
c98f0454
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
unit test for validation configuration elements and to string transformation
parent
ee916a27
No related branches found
No related tags found
1 merge request
!100
Test coverage unit tests
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/tests/models/test_configuration_item.py
+22
-1
22 additions, 1 deletion
smash/web/tests/models/test_configuration_item.py
with
22 additions
and
1 deletion
smash/web/tests/models/test_configuration_item.py
+
22
−
1
View file @
c98f0454
...
...
@@ -2,7 +2,9 @@ from django.test import TestCase
from
web.models
import
ConfigurationItem
from
web.models.constants
import
CANCELLED_APPOINTMENT_COLOR_CONFIGURATION_TYPE
,
\
NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE
NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE
,
KIT_EMAIL_HOUR_CONFIGURATION_TYPE
,
\
KIT_EMAIL_DAY_OF_WEEK_CONFIGURATION_TYPE
from
web.tests.functions
import
create_configuration_item
class
ConfigurationItemModelTests
(
TestCase
):
...
...
@@ -12,3 +14,22 @@ class ConfigurationItemModelTests(TestCase):
items
=
ConfigurationItem
.
objects
.
filter
(
type
=
NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE
)
self
.
assertTrue
(
len
(
items
)
>
0
)
def
test_str
(
self
):
configuration_item
=
create_configuration_item
()
self
.
assertIsNotNone
(
str
(
configuration_item
))
self
.
assertIsNotNone
(
unicode
(
configuration_item
))
def
test_validate
(
self
):
item
=
ConfigurationItem
.
objects
.
filter
(
type
=
KIT_EMAIL_HOUR_CONFIGURATION_TYPE
)[
0
]
item
.
value
=
"
09:00
"
self
.
assertEqual
(
""
,
ConfigurationItem
.
validation_error
(
item
))
item
.
value
=
"
text
"
self
.
assertNotEqual
(
""
,
ConfigurationItem
.
validation_error
(
item
))
item
=
ConfigurationItem
.
objects
.
filter
(
type
=
KIT_EMAIL_DAY_OF_WEEK_CONFIGURATION_TYPE
)[
0
]
item
.
value
=
"
MONDAY
"
self
.
assertEqual
(
""
,
ConfigurationItem
.
validation_error
(
item
))
item
.
value
=
"
unknown day
"
self
.
assertNotEqual
(
""
,
ConfigurationItem
.
validation_error
(
item
))
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