diff options
author | stark, steven <ss820f@att.com> | 2018-04-17 12:40:01 -0700 |
---|---|---|
committer | stark, steven <ss820f@att.com> | 2018-04-17 12:40:01 -0700 |
commit | ce719de6d17d9b5f4233c130a6586ce265b7fe03 (patch) | |
tree | c3c3fe75a37ed8f308c56099c42a297da1b29ddc | |
parent | 19f2be755e52cef45612e63c9c56d8b298f05b25 (diff) |
[VVP] adding 2 tests to increase sonar
Added tests for frontend and config for sonar coverage
Change-Id: I9a3648c84c6d673bd86232debbedb1bcfce0d253
Issue-ID: VVP-55
Signed-off-by: stark, steven <ss820f@att.com>
-rw-r--r-- | imagescanner/imagescanner/tests/test_config.py | 46 | ||||
-rw-r--r-- | imagescanner/imagescanner/tests/test_frontend.py | 45 | ||||
-rw-r--r-- | requirements.txt | 4 | ||||
-rw-r--r-- | tox.ini | 2 |
4 files changed, 96 insertions, 1 deletions
diff --git a/imagescanner/imagescanner/tests/test_config.py b/imagescanner/imagescanner/tests/test_config.py new file mode 100644 index 0000000..41dd446 --- /dev/null +++ b/imagescanner/imagescanner/tests/test_config.py @@ -0,0 +1,46 @@ +# ============LICENSE_START======================================================= +# org.onap.vvp/image-scanner +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the “License”); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +import os +from .. import config +from pathlib import Path + + +def test_configuration(): + os.environ['IMAGESCANNER_LOGS_PATH'] = '.' + assert config.LOGS_PATH == Path('.') diff --git a/imagescanner/imagescanner/tests/test_frontend.py b/imagescanner/imagescanner/tests/test_frontend.py new file mode 100644 index 0000000..695961e --- /dev/null +++ b/imagescanner/imagescanner/tests/test_frontend.py @@ -0,0 +1,45 @@ +# ============LICENSE_START======================================================= +# org.onap.vvp/image-scanner +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the “License”); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +from .. import frontend + + +def test_frontend_invalid(): + app = frontend.app + resp = app.test_client().get('/imagescanner/result/invalidlocation') + assert resp.status_code == 404 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..62f85d5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +celery[redis] +flask +requests +requests-aws @@ -10,7 +10,7 @@ commands = {envpython} --version pytest --version pytest --cov imagescanner --cov-report=xml --cov-report=term --verbose -deps = +deps = -rrequirements.txt flake8 pytest-cov pytest |