Commit 293dfd59 authored by Kostas Vogias's avatar Kostas Vogias Committed by Stavros Sachtouris

Unit-test methods even if they are disabled

parent 0fb3f97e
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
from soi.tests import fakes from soi.tests import fakes
from soi import compute, config from soi import compute
from soi.tests.utils import clear_disabled_methods_list
from mock import patch from mock import patch
from base64 import b64encode from base64 import b64encode
DISABLED_METHODS = () clear_disabled_methods_list()
setattr(config, 'DISABLED_METHODS', DISABLED_METHODS)
@patch('soi.tests.fakes.DummyClass.get_from_response', return_value='g f r') @patch('soi.tests.fakes.DummyClass.get_from_response', return_value='g f r')
......
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
from soi.tests import fakes from soi.tests import fakes
from soi import storage, config from soi import storage
from soi.tests.utils import clear_disabled_methods_list
from mock import patch from mock import patch
DISABLED_METHODS = () clear_disabled_methods_list()
setattr(config, 'DISABLED_METHODS', DISABLED_METHODS)
def test_openstackify_volumes_info(): def test_openstackify_volumes_info():
......
...@@ -13,18 +13,18 @@ ...@@ -13,18 +13,18 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
from soi.tests import fakes from soi.tests import fakes
from soi import storage_link, config from soi import storage_link
from soi.tests.utils import clear_disabled_methods_list
from mock import patch from mock import patch
clear_disabled_methods_list()
@patch('soi.tests.fakes.DummyClass.get_from_response') @patch('soi.tests.fakes.DummyClass.get_from_response')
@patch('soi.tests.fakes.FakeReq.get_response', return_value='my response') @patch('soi.tests.fakes.FakeReq.get_response', return_value='my response')
def test_snf_get_server_volume_links(gr, gfr): def test_snf_get_server_volume_links(gr, gfr):
"""Test snf_get_server_volume_links method""" """Test snf_get_server_volume_links method"""
DISABLED_METHODS = ()
setattr(config, 'DISABLED_METHODS', DISABLED_METHODS)
cls, req = fakes.DummyClass(), fakes.FakeReq() cls, req = fakes.DummyClass(), fakes.FakeReq()
server_id = '1234' server_id = '1234'
storage_link.snf_get_server_volume_links(cls, req, server_id) storage_link.snf_get_server_volume_links(cls, req, server_id)
...@@ -42,9 +42,6 @@ def test_snf_get_server_volume_links(gr, gfr): ...@@ -42,9 +42,6 @@ def test_snf_get_server_volume_links(gr, gfr):
def test_snf_create_server_volume_link(gr, gfr): def test_snf_create_server_volume_link(gr, gfr):
"""Test snf_create_server_volume_link method""" """Test snf_create_server_volume_link method"""
DISABLED_METHODS = ()
setattr(config, 'DISABLED_METHODS', DISABLED_METHODS)
cls, req = fakes.DummyClass(), fakes.FakeReq() cls, req = fakes.DummyClass(), fakes.FakeReq()
server_id = '1234' server_id = '1234'
volume_id = '666' volume_id = '666'
...@@ -69,8 +66,6 @@ def test_snf_create_server_volume_link(gr, gfr): ...@@ -69,8 +66,6 @@ def test_snf_create_server_volume_link(gr, gfr):
@patch('soi.tests.fakes.FakeReq.get_response', return_value='my response') @patch('soi.tests.fakes.FakeReq.get_response', return_value='my response')
def test_snf_delete_server_volumes_link(gr): def test_snf_delete_server_volumes_link(gr):
"""Test snf_delete_server_volumes_link method""" """Test snf_delete_server_volumes_link method"""
DISABLED_METHODS = ()
setattr(config, 'DISABLED_METHODS', DISABLED_METHODS)
cls, req = fakes.DummyClass(), fakes.FakeReq() cls, req = fakes.DummyClass(), fakes.FakeReq()
server_id = '1234' server_id = '1234'
......
# Copyright (C) 2016 GRNET S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
def clear_disabled_methods_list():
try:
import config
setattr(config, 'DISABLED_METHODS', ())
except ImportError:
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment