Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
RadioObservatory
LOFAR
Commits
fd768cf1
Commit
fd768cf1
authored
1 year ago
by
Jörn Künsemöller
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-1996
: full test setup
parent
efd07733
No related branches found
No related tags found
1 merge request
!1163
Resolve TMSS-1996
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/backend/services/report_refresh/test/t_report_refresh_service.py
+24
-5
24 additions, 5 deletions
.../services/report_refresh/test/t_report_refresh_service.py
with
24 additions
and
5 deletions
SAS/TMSS/backend/services/report_refresh/test/t_report_refresh_service.py
+
24
−
5
View file @
fd768cf1
...
...
@@ -47,8 +47,6 @@ class TestReportRefreshService(unittest.TestCase):
cls
.
tmss_test_env
=
TMSSTestEnvironment
(
exchange
=
cls
.
tmp_exchange
.
address
,
populate_test_data
=
False
,
populate_schemas
=
False
,
start_websocket
=
False
,
start_postgres_listener
=
True
,
enable_viewflow
=
False
)
cls
.
tmss_test_env
.
start
()
cls
.
test_data_creator
=
cls
.
tmss_test_env
.
create_test_data_creator
()
@classmethod
def
tearDownClass
(
cls
)
->
None
:
cls
.
tmss_test_env
.
stop
()
...
...
@@ -60,12 +58,33 @@ class TestReportRefreshService(unittest.TestCase):
of a cycle report in the database.
'''
# test data setup
from
lofar.sas.tmss.test
import
tmss_test_data_django_models
from
lofar.sas.tmss.tmss.tmssapp
import
models
project
=
models
.
Project
.
objects
.
create
(
**
tmss_test_data_django_models
.
Project_test_data
(
name
=
str
(
uuid
.
uuid4
())))
cycle
=
models
.
Cycle
.
objects
.
create
(
**
tmss_test_data_django_models
.
Cycle_test_data
(
name
=
str
(
uuid
.
uuid4
())))
project
.
cycles
.
set
([
cycle
])
project
.
save
()
scheduling_set
=
models
.
SchedulingSet
.
objects
.
create
(
**
tmss_test_data_django_models
.
SchedulingSet_test_data
(
project
=
project
))
scheduling_unit_template
=
models
.
SchedulingUnitTemplate
.
get_latest
(
name
=
'
scheduling unit
'
)
scheduling_unit_draft
=
models
.
SchedulingUnitDraft
.
objects
.
create
(
**
tmss_test_data_django_models
.
SchedulingUnitDraft_test_data
(
name
=
str
(
uuid
.
uuid4
()),
template
=
scheduling_unit_template
,
scheduling_set
=
scheduling_set
))
obs_task_template
=
models
.
TaskTemplate
.
get_latest
(
name
=
'
target observation
'
)
task_draft
=
models
.
TaskDraft
.
objects
.
create
(
**
tmss_test_data_django_models
.
TaskDraft_test_data
(
name
=
str
(
uuid
.
uuid4
()),
specifications_template
=
obs_task_template
,
scheduling_unit_draft
=
scheduling_unit_draft
))
task_blueprint
=
models
.
TaskBlueprint
.
objects
.
create
(
**
tmss_test_data_django_models
.
TaskBlueprint_test_data
(
name
=
str
(
uuid
.
uuid4
()),
task_draft
=
task_draft
))
subtask_obs
=
models
.
Subtask
.
objects
.
create
(
**
tmss_test_data_django_models
.
Subtask_test_data
(
state
=
models
.
SubtaskState
.
objects
.
get
(
value
=
"
defining
"
),
subtask_template
=
models
.
SubtaskTemplate
.
get_latest
(
name
=
'
observation control
'
),
task_blueprint
=
task_blueprint
))
subtask_obs
.
state
=
models
.
SubtaskState
.
objects
.
get
(
value
=
"
defined
"
)
subtask_obs
.
save
()
# create and start the service (the object under test)
service
=
create_service
(
exchange
=
self
.
tmp_exchange
.
address
)
with
BusListenerJanitor
(
service
):
pass
# todo
self
.
assertEqual
(
models
.
CycleReport
.
objects
.
filter
(
cycle
=
cycle
).
count
(),
0
)
subtask_obs
.
state
=
models
.
SubtaskState
.
objects
.
get
(
value
=
"
defined
"
)
subtask_obs
.
save
()
time
.
sleep
(
5
)
# todo: ugly, is there a better way?
self
.
assertEqual
(
models
.
CycleReport
.
objects
.
filter
(
cycle
=
cycle
).
count
(),
1
)
if
__name__
==
'
__main__
'
:
...
...
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