-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
79 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
language: python | ||
python: | ||
- '2.7' | ||
|
||
before_install: | ||
- pip install -r requirements.txt | ||
- pip install -r test_requirements.txt | ||
- pip install coveralls | ||
- "2.7" | ||
|
||
install: | ||
- python setup.py install | ||
- 'if [ ${TRAVIS_BRANCH} \!= "master" ] && [ -f dev_requirements.txt ]; then | ||
pip install --extra-index-url https://testpypi.python.org/pypi -r dev_requirements.txt; | ||
python setup.py develop --no-deps; | ||
else | ||
python setup.py install; | ||
fi' | ||
- pip install -r test_requirements.txt | ||
- pip install coveralls | ||
|
||
script: | ||
- python setup.py develop | ||
- nosetests --with-coverage --cover-package=cloudshell | ||
- nosetests --with-coverage --cover-package=cloudshell.networking tests | ||
|
||
after_success: | ||
coveralls | ||
- coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
ipcalc==1.1.3 | ||
jsonpickle==0.9.3 | ||
cloudshell-shell-core>=3.1,<3.2 | ||
cloudshell-shell-core>=4.0,<4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
mock==2.0.0 | ||
ipcalc==1.1.3 | ||
jsonpickle==0.9.3 | ||
cloudshell-shell-core>=2.2.217,<2.4 | ||
nose | ||
coverage | ||
unittest2 | ||
mock |
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
42 changes: 42 additions & 0 deletions
42
tests/networking/apply_connectivity/models/test_connectivity_result.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import unittest | ||
|
||
import mock | ||
|
||
from cloudshell.networking.apply_connectivity.models.connectivity_result import ConnectivityErrorResponse | ||
from cloudshell.networking.apply_connectivity.models.connectivity_result import ConnectivitySuccessResponse | ||
|
||
|
||
class TestConnectivitySuccessResponse(unittest.TestCase): | ||
def test_init(self): | ||
"""Check that __init__ nethod will set up object with correct params""" | ||
action = mock.MagicMock() | ||
result_string = "info message" | ||
|
||
# act | ||
response = ConnectivitySuccessResponse(action=action, result_string=result_string) | ||
|
||
# verify | ||
self.assertEqual(response.type, action.type) | ||
self.assertEqual(response.actionId, action.actionId) | ||
self.assertIsNone(response.errorMessage) | ||
self.assertEqual(response.updatedInterface, action.actionTarget.fullName) | ||
self.assertEqual(response.infoMessage, result_string) | ||
self.assertTrue(response.success) | ||
|
||
|
||
class TestConnectivityErrorResponse(unittest.TestCase): | ||
def test_init(self): | ||
"""Check that __init__ nethod will set up object with correct params""" | ||
action = mock.MagicMock() | ||
err_string = "error message" | ||
|
||
# act | ||
response = ConnectivityErrorResponse(action=action, error_string=err_string) | ||
|
||
# verify | ||
self.assertEqual(response.type, action.type) | ||
self.assertEqual(response.actionId, action.actionId) | ||
self.assertIsNone(response.infoMessage) | ||
self.assertEqual(response.updatedInterface, action.actionTarget.fullName) | ||
self.assertEqual(response.errorMessage, err_string) | ||
self.assertFalse(response.success) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
tests/networking/test_networking_resource_driver_interface.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import unittest | ||
|
||
from cloudshell.networking.networking_resource_driver_interface import NetworkingResourceDriverInterface | ||
|
||
|
||
class TestNetworkingResourceDriverInterface(unittest.TestCase): | ||
def test_abstract_methods(self): | ||
"""Check that instance can't be instantiated without implementation of all abstract methods""" | ||
class TestedClass(NetworkingResourceDriverInterface): | ||
pass | ||
|
||
with self.assertRaisesRegexp(TypeError, "Can't instantiate abstract class TestedClass with abstract methods " | ||
"ApplyConnectivityChanges, get_inventory, health_check, load_firmware, " | ||
"orchestration_restore, orchestration_save, restore, " | ||
"run_custom_command, run_custom_config_command, save, shutdown"): | ||
TestedClass() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.0.0 | ||
5.1.0 |