def test_get_management_network_name_without_properties(self):
     ''' without name in properties '''
     fake_ctx = cfy_mocks.MockCloudifyContext(
         node_id='test',
         node_name='test',
         properties={})
     with mock.patch('server_plugin.server.ctx', fake_ctx):
         with self.assertRaises(cfy_exc.NonRecoverableError):
             server._get_management_network_from_node()
 def test_get_management_network_name_in_properties(self):
     ''' exist some managment network name in properties '''
     fake_ctx = cfy_mocks.MockCloudifyContext(
         node_id='test',
         node_name='test',
         properties={
             'management_network': '_management_network'
         })
     with mock.patch('server_plugin.server.ctx', fake_ctx):
         self.assertEqual(
             '_management_network',
             server._get_management_network_from_node()
         )
 def test_get_management_network_name_in_provider_context(self):
     ''' with name in provider_context '''
     fake_ctx = cfy_mocks.MockCloudifyContext(
         node_id='test',
         node_name='test',
         properties={},
         provider_context={
             'resources': {
                 'int_network': {
                     'name': '_management_network'
                 }
             }
         })
     with mock.patch('server_plugin.server.ctx', fake_ctx):
         self.assertEqual(
             '_management_network',
             server._get_management_network_from_node()
         )
 def test_get_management_network_without_name_in_context(self):
     ''' without name in provider_context '''
     fake_ctx = cfy_mocks.MockCloudifyContext(
         node_id='test',
         node_name='test',
         properties={},
         provider_context={
             'resources': {
                 'int_network': {
                     'other_name': '_management_network'
                 }
             }
         })
     with mock.patch('server_plugin.server.ctx', fake_ctx):
         with self.assertRaises(cfy_exc.NonRecoverableError):
             self.assertEqual(
                 '_management_network',
                 server._get_management_network_from_node()
             )