from osm_mon.collector.utils.openstack import OpenstackUtils
-@mock.patch('osm_mon.collector.utils.openstack.session')
+@mock.patch("osm_mon.collector.utils.openstack.session")
class OpenstackUtilsTest(TestCase):
-
def setUp(self):
super().setUp()
def test_session_without_insecure(self, mock_session):
creds = {
- 'config': {
- },
- 'vim_url': 'url',
- 'vim_user': 'user',
- 'vim_password': 'password',
- 'vim_tenant_name': 'tenant_name'
+ "config": {},
+ "vim_url": "url",
+ "vim_user": "user",
+ "vim_password": "password",
+ "vim_tenant_name": "tenant_name",
}
OpenstackUtils.get_session(creds)
mock_session.Session.assert_called_once_with(
- auth=mock.ANY, verify=True, timeout=10)
+ auth=mock.ANY, verify=True, timeout=10
+ )
def test_session_with_insecure(self, mock_session):
creds = {
- 'config': {
- 'insecure': True
- },
- 'vim_url': 'url',
- 'vim_user': 'user',
- 'vim_password': 'password',
- 'vim_tenant_name': 'tenant_name'
+ "config": {"insecure": True},
+ "vim_url": "url",
+ "vim_user": "user",
+ "vim_password": "password",
+ "vim_tenant_name": "tenant_name",
}
OpenstackUtils.get_session(creds)
mock_session.Session.assert_called_once_with(
- auth=mock.ANY, verify=False, timeout=10)
+ auth=mock.ANY, verify=False, timeout=10
+ )
def test_session_with_insecure_false(self, mock_session):
creds = {
- 'config': {
- 'insecure': False
- },
- 'vim_url': 'url',
- 'vim_user': 'user',
- 'vim_password': 'password',
- 'vim_tenant_name': 'tenant_name'
+ "config": {"insecure": False},
+ "vim_url": "url",
+ "vim_user": "user",
+ "vim_password": "password",
+ "vim_tenant_name": "tenant_name",
}
OpenstackUtils.get_session(creds)
mock_session.Session.assert_called_once_with(
- auth=mock.ANY, verify=True, timeout=10)
+ auth=mock.ANY, verify=True, timeout=10
+ )