48 lines
1.7 KiB
Python
48 lines
1.7 KiB
Python
# Copyright (c) 2014 Andrew Kerr. All rights reserved.
|
|
# All Rights Reserved.
|
|
#
|
|
# 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. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
"""
|
|
Mock unit tests for the NetApp nfs storage driver
|
|
"""
|
|
|
|
import mock
|
|
|
|
from cinder.brick.remotefs import remotefs as remotefs_brick
|
|
from cinder import test
|
|
from cinder import utils
|
|
from cinder.volume.drivers.netapp.dataontap import nfs_base
|
|
from cinder.volume.drivers.netapp import utils as na_utils
|
|
from cinder.volume.drivers import nfs
|
|
|
|
|
|
class NetAppNfsDriverTestCase(test.TestCase):
|
|
def setUp(self):
|
|
super(NetAppNfsDriverTestCase, self).setUp()
|
|
|
|
kwargs = {'configuration': mock.Mock()}
|
|
|
|
with mock.patch.object(utils, 'get_root_helper',
|
|
return_value=mock.Mock()):
|
|
with mock.patch.object(remotefs_brick, 'RemoteFsClient',
|
|
return_value=mock.Mock()):
|
|
self.driver = nfs_base.NetAppNfsDriver(**kwargs)
|
|
|
|
@mock.patch.object(nfs.NfsDriver, 'do_setup')
|
|
@mock.patch.object(na_utils, 'check_flags')
|
|
def test_do_setup(self, mock_check_flags, mock_super_do_setup):
|
|
self.driver.do_setup(mock.Mock())
|
|
|
|
self.assertTrue(mock_check_flags.called)
|
|
self.assertTrue(mock_super_do_setup.called)
|