FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ews-coordinator
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container Registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab has been upgraded. See what's new in the
Changelog
.
Show more breadcrumbs
Gilligan Lab for Epidemiology and Modelling
Wheat rusts
ews-coordinator
Commits
9cf51cc8
Commit
9cf51cc8
authored
2 years ago
by
L. Bower
Browse files
Options
Downloads
Patches
Plain Diff
adding basic advisory tests
parent
1d47c1c4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+4
-4
4 additions, 4 deletions
.gitlab-ci.yml
tests/integration/test_advisory.py
+44
-16
44 additions, 16 deletions
tests/integration/test_advisory.py
tests/integration/test_env_suit.py
+2
-2
2 additions, 2 deletions
tests/integration/test_env_suit.py
with
50 additions
and
22 deletions
.gitlab-ci.yml
+
4
−
4
View file @
9cf51cc8
...
@@ -59,10 +59,10 @@ test:
...
@@ -59,10 +59,10 @@ test:
-
python -m coverage html -d $CI_PROJECT_DIR/coverage
-
python -m coverage html -d $CI_PROJECT_DIR/coverage
-
cd $CI_PROJECT_DIR/tests/integration
-
cd $CI_PROJECT_DIR/tests/integration
-
python3 -m coverage run -m unittest test_deposition.py
-
python3 -m coverage run -m unittest test_deposition.py
#
- python3 -m unittest test_deposition.py
-
python3 -m unittest test_deposition.py
#
- python3 -m unittest test_env_suit.py
-
python3 -m unittest test_env_suit.py
#
- python3 -m unittest test_survey.py
-
python3 -m unittest test_survey.py
#
- python3 -m unittest test_advisory.py
-
python3 -m unittest test_advisory.py
-
python -m coverage report
-
python -m coverage report
-
python -m coverage html -d $CI_PROJECT_DIR/coverage
-
python -m coverage html -d $CI_PROJECT_DIR/coverage
-
ls
-
ls
...
...
This diff is collapsed.
Click to expand it.
tests/integration/test_advisory.py
+
44
−
16
View file @
9cf51cc8
...
@@ -7,17 +7,35 @@ from integration.integration_test_utils import IntegrationTestUtils
...
@@ -7,17 +7,35 @@ from integration.integration_test_utils import IntegrationTestUtils
class
TestEnvSuit
(
unittest
.
TestCase
):
class
TestEnvSuit
(
unittest
.
TestCase
):
def
setUp
(
self
)
->
None
:
TEST_OUT_PATH
:
str
=
"
not_set
"
super
().
setUp
()
TEST_RUN_DATE
:
str
=
'
20221001
'
default_config
=
'
../test_data/test_deployment/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json
'
TEST_JOB_DIR
:
str
=
"
SUMMARY_
"
+
TEST_RUN_DATE
self
.
default_config_dict
:
dict
=
IntegrationTestUtils
.
load_json_file
(
default_config
)
def
test_env_suit_standard_inputs_expected_results1
(
self
):
@classmethod
def
setUpClass
(
cls
)
->
None
:
TestEnvSuit
.
write_temp_run_config_file
()
TestEnvSuit
.
run_advisory_pipeline
()
@staticmethod
def
write_temp_run_config_file
():
nowstring
:
str
=
IntegrationTestUtils
.
get_now_string
()
nowstring
:
str
=
IntegrationTestUtils
.
get_now_string
()
prefix
:
str
=
"
temp_advisory_
"
+
nowstring
prefix
:
str
=
"
temp_advisory_
"
+
nowstring
# prefix: str = ""
# prefix: str = ""
default_config
=
IntegrationTestUtils
.
DEFAULT_CONFIG_FILE_PATH
default_config_dict
:
dict
=
IntegrationTestUtils
.
load_json_file
(
default_config
)
run_dict
:
dict
=
copy
.
deepcopy
(
default_config_dict
)
TestEnvSuit
.
TEST_OUT_PATH
=
run_dict
[
'
WorkspacePathout
'
]
+
prefix
+
os
.
sep
run_dict
[
'
WorkspacePathout
'
]
=
TestEnvSuit
.
TEST_OUT_PATH
run_dict
[
'
WorkspacePath
'
]
=
TestEnvSuit
.
TEST_OUT_PATH
run_dict
[
'
ServerName
'
]
=
''
# nothing, as local machine
IntegrationTestUtils
.
write_json_file
(
run_dict
,
IntegrationTestUtils
.
TEMP_CONFIG_FILE_PATH
)
@staticmethod
def
run_advisory_pipeline
():
os
.
environ
[
"
EMAIL_CRED
"
]
=
"
../test_data/test_deployment/envs/Cred_gmail.json
"
os
.
environ
[
"
EMAIL_CRED
"
]
=
"
../test_data/test_deployment/envs/Cred_gmail.json
"
from
Processor
import
run_Process
,
set_log_level
from
Processor
import
run_Process
,
set_log_level
args_dict
:
dict
=
{}
args_dict
:
dict
=
{}
...
@@ -29,20 +47,30 @@ class TestEnvSuit(unittest.TestCase):
...
@@ -29,20 +47,30 @@ class TestEnvSuit(unittest.TestCase):
args_dict
[
'
noupload
'
]
=
True
args_dict
[
'
noupload
'
]
=
True
set_log_level
(
args_dict
[
'
log_level
'
])
set_log_level
(
args_dict
[
'
log_level
'
])
run_dict
:
dict
=
copy
.
deepcopy
(
self
.
default_config_dict
)
IntegrationTestUtils
.
unpack_zip
(
IntegrationTestUtils
.
EXAMPLE_SURVEY_FILE_PATH
,
TestEnvSuit
.
TEST_OUT_PATH
)
test_out_path
=
run_dict
[
'
WorkspacePathout
'
]
+
prefix
+
os
.
sep
IntegrationTestUtils
.
unpack_zip
(
IntegrationTestUtils
.
EXAMPLE_DEPO_FILE_PATH
,
TestEnvSuit
.
TEST_OUT_PATH
)
run_dict
[
'
WorkspacePathout
'
]
=
test_out_path
IntegrationTestUtils
.
unpack_zip
(
IntegrationTestUtils
.
EXAMPLE_ENV_SUIT_FILE_PATH
,
TestEnvSuit
.
TEST_OUT_PATH
)
run_dict
[
'
WorkspacePath
'
]
=
test_out_path
run_dict
[
'
ServerName
'
]
=
''
# nothing, as local machine
IntegrationTestUtils
.
write_json_file
(
run_dict
,
IntegrationTestUtils
.
TEMP_CONFIG_FILE_PATH
)
run_Process
(
args_dict
)
IntegrationTestUtils
.
unpack_zip
(
IntegrationTestUtils
.
EXAMPLE_SURVEY_FILE_PATH
,
test_out_path
)
def
test_standard_run_input_status_success
(
self
):
IntegrationTestUtils
.
unpack_zip
(
IntegrationTestUtils
.
EXAMPLE_DEPO_FILE_PATH
,
test_out_path
)
status_file_path
=
os
.
path
.
join
(
TestEnvSuit
.
TEST_OUT_PATH
,
TestEnvSuit
.
TEST_JOB_DIR
,
"
STATUS_SUCCESS
"
)
IntegrationTestUtils
.
unpack_zip
(
IntegrationTestUtils
.
EXAMPLE_ENV_SUIT_FILE_PATH
,
test_out_path
)
success_file_exists
:
bool
=
os
.
path
.
isfile
(
status_file_path
)
self
.
assertTrue
(
success_file_exists
)
run_Process
(
args_dict
)
def
test_standard_run_input_all_docs_produced
(
self
):
self
.
assertTrue
(
True
)
east_africa_image_path
=
os
.
path
.
join
(
TestEnvSuit
.
TEST_OUT_PATH
,
TestEnvSuit
.
TEST_JOB_DIR
,
"
tight-layout
"
,
"
wheat_rust_advisory_template_EastAfrica_20221001.docx
"
)
ethiopia_image_path
=
os
.
path
.
join
(
TestEnvSuit
.
TEST_OUT_PATH
,
TestEnvSuit
.
TEST_JOB_DIR
,
"
tight-layout
"
,
"
wheat_rust_advisory_template_Ethiopia_20221001.docx
"
)
ea_file_exists
:
bool
=
os
.
path
.
isfile
(
east_africa_image_path
)
eth_file_exists
:
bool
=
os
.
path
.
isfile
(
ethiopia_image_path
)
self
.
assertTrue
(
ea_file_exists
)
self
.
assertTrue
(
eth_file_exists
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
tests/integration/test_env_suit.py
+
2
−
2
View file @
9cf51cc8
...
@@ -6,15 +6,15 @@ from integration.integration_test_utils import IntegrationTestUtils
...
@@ -6,15 +6,15 @@ from integration.integration_test_utils import IntegrationTestUtils
class
TestEnvSuit
(
unittest
.
TestCase
):
class
TestEnvSuit
(
unittest
.
TestCase
):
TEST_OUT_PATH
:
str
=
"
not_set
"
TEST_OUT_PATH
:
str
=
"
not_set
"
TEST_RUN_DATE
:
str
=
'
20221001
'
TEST_RUN_DATE
:
str
=
'
20221001
'
TEST_JOB_DIR
:
str
=
"
ENVIRONMENT_2.0_
"
+
TEST_RUN_DATE
TEST_JOB_DIR
:
str
=
"
ENVIRONMENT_2.0_
"
+
TEST_RUN_DATE
@classmethod
@classmethod
def
setUpClass
(
cls
)
->
None
:
def
setUpClass
(
cls
)
->
None
:
TestEnvSuit
.
write_temp_run_config_file
()
TestEnvSuit
.
write_temp_run_config_file
()
#
TestEnvSuit.run_env_pipeline()
TestEnvSuit
.
run_env_pipeline
()
@staticmethod
@staticmethod
...
...
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