Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
compendium-v2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
geant-swd
compendium-v2
Commits
ff0050f1
Commit
ff0050f1
authored
2 years ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
update 2022 publisher test for staff data
parent
b8335901
No related branches found
No related tags found
1 merge request
!6
Feature/comp 125 staffing graph
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_survey_publisher_2022.py
+57
-3
57 additions, 3 deletions
test/test_survey_publisher_2022.py
with
57 additions
and
3 deletions
test/test_survey_publisher_2022.py
+
57
−
3
View file @
ff0050f1
from
compendium_v2
import
db
from
compendium_v2.db
import
model
from
compendium_v2.publishers.survey_publisher_2022
import
_cli
,
FundingSource
from
compendium_v2.publishers.survey_publisher_2022
import
_cli
,
FundingSource
,
Question
def
test_publisher
(
client
,
mocker
,
dummy_config
):
...
...
@@ -30,12 +30,44 @@ def test_publisher(client, mocker, dummy_config):
(
'
nren3
'
,
'
30
'
),
]
mocker
.
patch
(
'
compendium_v2.publishers.survey_publisher_2022.query_budget
'
,
# noqa
def
question_data
(
question
):
if
question
==
Question
.
non_technical_fte
:
return
[
(
'
nren1
'
,
'
10
'
),
(
'
nren2
'
,
'
80
'
),
(
'
nren3
'
,
'
30
'
),
]
if
question
==
Question
.
technical_fte
:
return
[
(
'
nren1
'
,
'
50
'
),
(
'
nren2
'
,
'
20
'
),
(
'
nren3
'
,
'
30
'
),
]
if
question
==
Question
.
permanent_fte
:
return
[
(
'
nren1
'
,
'
40
'
),
(
'
nren2
'
,
'
abc
'
),
(
'
nren3
'
,
'
30
'
),
]
if
question
==
Question
.
subcontracted_fte
:
return
[
(
'
nren1
'
,
'
0
'
),
(
'
nren2
'
,
'
0
'
),
(
'
nren3
'
,
'
0
'
),
]
mocker
.
patch
(
'
compendium_v2.publishers.survey_publisher_2022.query_budget
'
,
get_rows_as_tuples
)
mocker
.
patch
(
'
compendium_v2.publishers.survey_publisher_2022.query_funding_sources
'
,
# noqa
mocker
.
patch
(
'
compendium_v2.publishers.survey_publisher_2022.query_funding_sources
'
,
funding_source_data
)
mocker
.
patch
(
'
compendium_v2.publishers.survey_publisher_2022.query_question
'
,
question_data
)
with
db
.
session_scope
()
as
session
:
nren_names
=
[
'
Nren1
'
,
'
Nren2
'
,
'
Nren3
'
,
'
Nren4
'
,
...
...
@@ -70,3 +102,25 @@ def test_publisher(client, mocker, dummy_config):
assert
funding_sources
[
2
].
client_institutions
==
30
assert
funding_sources
[
2
].
european_funding
==
30
assert
funding_sources
[
2
].
other
==
30
staff_data
=
session
.
query
(
model
.
NrenStaff
).
order_by
(
model
.
NrenStaff
.
nren_id
.
asc
()).
all
()
assert
len
(
staff_data
)
==
3
assert
staff_data
[
0
].
nren
.
name
.
lower
()
==
'
nren1
'
assert
staff_data
[
0
].
non_technical_fte
==
10
assert
staff_data
[
0
].
technical_fte
==
50
assert
staff_data
[
0
].
permanent_fte
==
40
assert
staff_data
[
0
].
subcontracted_fte
==
0
assert
staff_data
[
1
].
nren
.
name
.
lower
()
==
'
nren2
'
assert
staff_data
[
1
].
non_technical_fte
==
80
assert
staff_data
[
1
].
technical_fte
==
20
assert
staff_data
[
1
].
permanent_fte
==
0
assert
staff_data
[
1
].
subcontracted_fte
==
0
assert
staff_data
[
2
].
nren
.
name
.
lower
()
==
'
nren3
'
assert
staff_data
[
2
].
non_technical_fte
==
30
assert
staff_data
[
2
].
technical_fte
==
30
assert
staff_data
[
2
].
permanent_fte
==
30
assert
staff_data
[
2
].
subcontracted_fte
==
0
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