target/
logs/*.log
*.pyc
+
+# Test related files
+multivimbroker/.coverage
+multivimbroker/.tox/
+multivimbroker/logs/*.log
+multivimbroker/test-reports/
--- /dev/null
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file 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.
+
+from multivimbroker.settings import * # noqa
+from multivimbroker.settings import INSTALLED_APPS
+
+INSTALLED_APPS.append('django_nose')
+
+TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
+
+NOSE_ARGS = [
+ '--with-coverage',
+ '--cover-package=multivimbroker',
+]
--- /dev/null
+# Copyright (c) 2017 Wind River Systems, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file 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.
--- /dev/null
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file 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.
+
+import json
+import mock
+import unittest
+
+from multivimbroker.pub.config import config
+from multivimbroker import urls
+
+
+class TestUrls(unittest.TestCase):
+
+ def test_request_msb(self):
+ with mock.patch("multivimbroker.pub.utils.restcall."
+ "req_by_msb") as req_by_msb:
+ urls.req_msb(True)
+ req_by_msb.assert_called_once_with(
+ config.REG_TO_MSB_REG_URL, "POST",
+ json.JSONEncoder().encode(config.REG_TO_MSB_REG_PARAM))
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
from django.conf.urls import include, url
-from multivimbroker.pub.config.config \
- import REG_TO_MSB_WHEN_START, REG_TO_MSB_REG_URL, REG_TO_MSB_REG_PARAM
+import json
+
+from multivimbroker.pub.config import config
+
urlpatterns = [
url(r'^', include('multivimbroker.swagger.urls')),
url(r'^', include('multivimbroker.forwarder.urls')),
]
-# regist to MSB when startup
-if REG_TO_MSB_WHEN_START:
- import json
- from multivimbroker.pub.utils.restcall import req_by_msb
- req_by_msb(REG_TO_MSB_REG_URL, "POST",
- json.JSONEncoder().encode(REG_TO_MSB_REG_PARAM))
+
+def req_msb(request_when_start):
+ # regist to MSB when startup
+ if request_when_start:
+ from multivimbroker.pub.utils.restcall import req_by_msb
+ req_by_msb(config.REG_TO_MSB_REG_URL, "POST",
+ json.JSONEncoder().encode(config.REG_TO_MSB_REG_PARAM))
+
+
+req_msb(config.REG_TO_MSB_WHEN_START)
python-neutronclient==6.0.0
# for unit test
+django-nose>=1.4.0
coverage==4.2
mock==2.0.0
unittest_xml_reporting==1.12.0
[testenv]
deps = -r{toxinidir}/requirements.txt
-commands = coverage run --branch manage.py test multivimbroker
+commands =
+ /usr/bin/find . -type f -name "*.py[c|o]" -delete
+ python manage.py test multivimbroker
[testenv:pep8]
deps=flake8
commands=flake8
+
+[testenv:py27]
+commands =
+ {[testenv]commands}
+
+[testenv:cover]
+setenv=
+ DJANGO_SETTINGS_MODULE = multivimbroker.settings-cover
+commands =
+ coverage erase
+ {[testenv]commands}