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
14e13dc7
Commit
14e13dc7
authored
4 years ago
by
Mario Raciti
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-692
: Add test case for Project report action
parent
cf594036
No related branches found
No related tags found
1 merge request
!410
Resolve TMSS-692
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SAS/TMSS/backend/src/tmss/tmssapp/viewsets/specification.py
+2
-3
2 additions, 3 deletions
SAS/TMSS/backend/src/tmss/tmssapp/viewsets/specification.py
SAS/TMSS/backend/test/t_adapter.py
+36
-0
36 additions, 0 deletions
SAS/TMSS/backend/test/t_adapter.py
with
38 additions
and
3 deletions
SAS/TMSS/backend/src/tmss/tmssapp/viewsets/specification.py
+
2
−
3
View file @
14e13dc7
...
...
@@ -349,12 +349,11 @@ class ProjectViewSet(LOFARViewSet):
return
queryset
@swagger_auto_schema
(
responses
=
{
200
:
'
The Report
'
,
@swagger_auto_schema
(
responses
=
{
200
:
'
The Report
information
'
,
403
:
'
forbidden
'
},
operation_description
=
"
Get Report for the project.
"
)
operation_description
=
"
Get Report
information
for the project.
"
)
@action
(
methods
=
[
'
get
'
],
detail
=
True
,
url_name
=
"
report
"
,
name
=
"
Get Report
"
)
def
report
(
self
,
request
,
pk
=
None
):
# TODO: Discuss about the endpoint choose. ATM is /project/<project-name>/report
project
=
get_object_or_404
(
models
.
Project
,
pk
=
pk
)
result
=
create_project_report
(
request
,
project
)
return
Response
(
result
,
status
=
status
.
HTTP_200_OK
)
...
...
This diff is collapsed.
Click to expand it.
SAS/TMSS/backend/test/t_adapter.py
+
36
−
0
View file @
14e13dc7
...
...
@@ -507,6 +507,42 @@ _isCobalt=T
self
.
assertEqual
(
self
.
feedback_pipe_complete
.
strip
(),
subtask_pipe
.
raw_feedback
.
strip
())
class
ProjectReportTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
# Create requirements
self
.
project
=
models
.
Project
.
objects
.
create
(
**
Project_test_data
(
name
=
'
test_for_report
'
))
self
.
scheduling_set
=
models
.
SchedulingSet
.
objects
.
create
(
**
SchedulingSet_test_data
(
project
=
self
.
project
))
self
.
scheduling_unit_draft
=
models
.
SchedulingUnitDraft
.
objects
.
create
(
**
SchedulingUnitDraft_test_data
(
scheduling_set
=
self
.
scheduling_set
))
self
.
task_draft
=
models
.
TaskDraft
.
objects
.
create
(
**
TaskDraft_test_data
(
scheduling_unit_draft
=
self
.
scheduling_unit_draft
))
self
.
scheduling_unit_blueprint
=
models
.
SchedulingUnitBlueprint
.
objects
.
create
(
**
SchedulingUnitBlueprint_test_data
(
draft
=
self
.
scheduling_unit_draft
))
self
.
task_blueprint
=
models
.
TaskBlueprint
.
objects
.
create
(
**
TaskBlueprint_test_data
(
task_draft
=
self
.
task_draft
,
scheduling_unit_blueprint
=
self
.
scheduling_unit_blueprint
))
def
test_create_report
(
self
):
# TODO: Add ProjectQuota sample.
# Create Subtask of type 'ingest'
subtask_template
=
models
.
SubtaskTemplate
.
objects
.
create
(
**
SubtaskTemplate_test_data
(
subtask_type_value
=
'
ingest
'
))
subtask
=
models
.
Subtask
.
objects
.
create
(
**
Subtask_test_data
(
task_blueprint
=
self
.
task_blueprint
,
subtask_template
=
subtask_template
))
# Set Subtask status to 'finished'
with
tmss_test_env
.
create_tmss_client
()
as
client
:
client
.
set_subtask_status
(
subtask
.
pk
,
'
finished
'
)
# Refreshing Subtask from cache.
subtask
=
models
.
Subtask
.
objects
.
get
(
pk
=
subtask
.
pk
)
while
subtask
.
state
.
value
!=
'
finished
'
:
subtask
=
models
.
Subtask
.
objects
.
get
(
pk
=
subtask
.
pk
)
# Create SubtaskOutput and Dataproduct
subtask_output
=
models
.
SubtaskOutput
.
objects
.
create
(
**
SubtaskOutput_test_data
(
subtask
=
subtask
))
dataproduct
=
models
.
Dataproduct
.
objects
.
create
(
**
Dataproduct_test_data
(
producer
=
subtask_output
))
# TODO: Assert we get the expected object.
if
__name__
==
"
__main__
"
:
os
.
environ
[
'
TZ
'
]
=
'
UTC
'
...
...
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