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
d82cb29c
There was a problem fetching the pipeline metadata.
Commit
d82cb29c
authored
8 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into 84-performance-of-subject-list
parents
1254d304
40ecf864
No related branches found
No related tags found
1 merge request
!34
Performance of subject list
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/tests/test_statistics.py
+6
-3
6 additions, 3 deletions
smash/web/tests/test_statistics.py
with
6 additions
and
3 deletions
smash/web/tests/test_statistics.py
+
6
−
3
View file @
d82cb29c
...
@@ -6,16 +6,19 @@ from django.test import TestCase
...
@@ -6,16 +6,19 @@ from django.test import TestCase
from
web.models
import
Visit
from
web.models
import
Visit
from
web.statistics
import
get_previous_year_and_month_for_date
,
StatisticsManager
from
web.statistics
import
get_previous_year_and_month_for_date
,
StatisticsManager
from
web.tests.functions
import
create_appointment
,
create_appointment_type
from
web.tests.functions
import
create_appointment
,
create_appointment_type
from
web.views.notifications
import
get_today_midnight_date
__author__
=
'
Valentin Grouès
'
__author__
=
'
Valentin Grouès
'
class
TestStatistics
(
TestCase
):
class
TestStatistics
(
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
now
=
datetime
.
datetime
.
now
()
self
.
now
=
get_today_midnight_date
()
self
.
appointment_type
=
create_appointment_type
()
self
.
appointment_type
=
create_appointment_type
()
appointment
=
create_appointment
(
when
=
self
.
now
)
appointment
=
create_appointment
(
when
=
self
.
now
)
appointment
.
appointment_types
=
[
self
.
appointment_type
]
appointment
.
appointment_types
=
[
self
.
appointment_type
]
self
.
visit_start
=
appointment
.
visit
.
datetime_begin
self
.
visit_end
=
appointment
.
visit
.
datetime_end
appointment
.
save
()
appointment
.
save
()
self
.
subject
=
appointment
.
visit
.
subject
self
.
subject
=
appointment
.
visit
.
subject
self
.
statistics_manager
=
StatisticsManager
()
self
.
statistics_manager
=
StatisticsManager
()
...
@@ -31,13 +34,13 @@ class TestStatistics(TestCase):
...
@@ -31,13 +34,13 @@ class TestStatistics(TestCase):
self
.
assertEqual
(
12
,
previous_month
)
self
.
assertEqual
(
12
,
previous_month
)
def
test_get_statistics_for_month_one_appointment
(
self
):
def
test_get_statistics_for_month_one_appointment
(
self
):
statistics
=
self
.
statistics_manager
.
get_statistics_for_month
(
self
.
now
.
month
-
1
,
self
.
now
.
year
)
statistics
=
self
.
statistics_manager
.
get_statistics_for_month
(
self
.
visit_start
.
month
,
self
.
now
.
year
)
self
.
check_statistics
(
statistics
,
1
,
0
,
0
,
{
"
C
"
:
[
0
,
0
]},
[
'
Scheduled
'
])
self
.
check_statistics
(
statistics
,
1
,
0
,
0
,
{
"
C
"
:
[
0
,
0
]},
[
'
Scheduled
'
])
statistics
=
self
.
statistics_manager
.
get_statistics_for_month
(
self
.
now
.
month
,
self
.
now
.
year
)
statistics
=
self
.
statistics_manager
.
get_statistics_for_month
(
self
.
now
.
month
,
self
.
now
.
year
)
self
.
check_statistics
(
statistics
,
0
,
0
,
1
,
{
"
C
"
:
[
1
,
1
]},
[
'
Scheduled
'
])
self
.
check_statistics
(
statistics
,
0
,
0
,
1
,
{
"
C
"
:
[
1
,
1
]},
[
'
Scheduled
'
])
statistics
=
self
.
statistics_manager
.
get_statistics_for_month
(
self
.
now
.
month
+
1
,
self
.
now
.
year
)
statistics
=
self
.
statistics_manager
.
get_statistics_for_month
(
self
.
visit_end
.
month
,
self
.
now
.
year
)
self
.
check_statistics
(
statistics
,
0
,
1
,
0
,
{
"
C
"
:
[
0
,
0
]},
[
'
Scheduled
'
])
self
.
check_statistics
(
statistics
,
0
,
1
,
0
,
{
"
C
"
:
[
0
,
0
]},
[
'
Scheduled
'
])
def
test_get_statistics_for_month_one_appointment_visit
(
self
):
def
test_get_statistics_for_month_one_appointment_visit
(
self
):
...
...
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