Added .gitreview file
Change-Id: I3245862dffd095f2d263bd53b46ba31f3cf6a7ed
This commit is contained in:
parent
9deba4829f
commit
048fcbf927
|
@ -0,0 +1,4 @@
|
|||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=stackforge/python-muranoclient.git
|
|
@ -10,4 +10,4 @@
|
|||
# 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.
|
||||
# under the License.
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
# 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.
|
||||
# under the License.
|
||||
|
|
|
@ -22,15 +22,14 @@ LOG = logging.getLogger('Unit tests')
|
|||
|
||||
|
||||
class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
||||
|
||||
@httprettified
|
||||
def test_client_env_list_with_empty_list(self):
|
||||
HTTPretty.register_uri(HTTPretty.GET,
|
||||
"http://no-resolved-host:8001/environments",
|
||||
body='{"environments": []}',
|
||||
adding_headers={
|
||||
'Content-Type': 'application/json',})
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
'Content-Type': 'application/json', })
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
test_client = Client('1', endpoint=endpoint, token='1', timeout=10)
|
||||
|
||||
result = test_client.environments.list()
|
||||
|
@ -54,8 +53,8 @@ class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
|||
"http://no-resolved-host:8001/environments",
|
||||
body=body,
|
||||
adding_headers={
|
||||
'Content-Type': 'application/json',})
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
'Content-Type': 'application/json', })
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
test_client = Client('1', endpoint=endpoint, token='1', timeout=10)
|
||||
|
||||
result = test_client.environments.list()
|
||||
|
@ -65,17 +64,16 @@ class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
|||
@httprettified
|
||||
def test_client_env_create(self):
|
||||
body = ('{"id": "0ce373a477f211e187a55404a662f968",'
|
||||
'"name": "test",'
|
||||
'"created": "2010-11-30T03:23:42Z",'
|
||||
'"updated": "2010-11-30T03:23:44Z",'
|
||||
'"tenant-id": "0849006f7ce94961b3aab4e46d6f229a"}'
|
||||
)
|
||||
'"name": "test",'
|
||||
'"created": "2010-11-30T03:23:42Z",'
|
||||
'"updated": "2010-11-30T03:23:44Z",'
|
||||
'"tenant-id": "0849006f7ce94961b3aab4e46d6f229a"}')
|
||||
HTTPretty.register_uri(HTTPretty.POST,
|
||||
"http://no-resolved-host:8001/environments",
|
||||
body=body,
|
||||
adding_headers={
|
||||
'Content-Type': 'application/json',})
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
'Content-Type': 'application/json', })
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
test_client = Client('1', endpoint=endpoint, token='1', timeout=10)
|
||||
|
||||
result = test_client.environments.create('test')
|
||||
|
@ -98,8 +96,8 @@ class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
|||
HTTPretty.register_uri(HTTPretty.GET, url,
|
||||
body=body,
|
||||
adding_headers={
|
||||
'Content-Type': 'application/json',})
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
'Content-Type': 'application/json', })
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
test_client = Client('1', endpoint=endpoint, token='1', timeout=10)
|
||||
|
||||
result = test_client.activeDirectories.list('1', 'test')
|
||||
|
@ -122,8 +120,8 @@ class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
|||
HTTPretty.register_uri(HTTPretty.POST, url,
|
||||
body=body,
|
||||
adding_headers={
|
||||
'Content-Type': 'application/json',})
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
'Content-Type': 'application/json', })
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
test_client = Client('1', endpoint=endpoint, token='1', timeout=10)
|
||||
|
||||
result = test_client.activeDirectories.create('1', 'test', 'ad1')
|
||||
|
@ -131,14 +129,14 @@ class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
|||
|
||||
@httprettified
|
||||
def test_client_ad_list_without_elements(self):
|
||||
body = ('{"activeDirectories": []}')
|
||||
body = '{"activeDirectories": []}'
|
||||
url = ("http://no-resolved-host:8001/environments"
|
||||
"/1/activeDirectories")
|
||||
HTTPretty.register_uri(HTTPretty.GET, url,
|
||||
body=body,
|
||||
adding_headers={
|
||||
'Content-Type': 'application/json',})
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
'Content-Type': 'application/json', })
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
test_client = Client('1', endpoint=endpoint, token='1', timeout=10)
|
||||
|
||||
result = test_client.activeDirectories.list('1', 'test')
|
||||
|
@ -161,8 +159,8 @@ class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
|||
HTTPretty.register_uri(HTTPretty.GET, url,
|
||||
body=body,
|
||||
adding_headers={
|
||||
'Content-Type': 'application/json',})
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
'Content-Type': 'application/json', })
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
test_client = Client('1', endpoint=endpoint, token='1', timeout=10)
|
||||
|
||||
result = test_client.webServers.list('1', 'test')
|
||||
|
@ -185,8 +183,8 @@ class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
|||
HTTPretty.register_uri(HTTPretty.POST, url,
|
||||
body=body,
|
||||
adding_headers={
|
||||
'Content-Type': 'application/json',})
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
'Content-Type': 'application/json', })
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
test_client = Client('1', endpoint=endpoint, token='1', timeout=10)
|
||||
|
||||
result = test_client.webServers.create('1', 'test', 'iis12')
|
||||
|
@ -194,14 +192,14 @@ class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
|||
|
||||
@httprettified
|
||||
def test_client_iis_list_without_elements(self):
|
||||
body = ('{"webServers": []}')
|
||||
body = '{"webServers": []}'
|
||||
url = ("http://no-resolved-host:8001/environments"
|
||||
"/1/webServers")
|
||||
HTTPretty.register_uri(HTTPretty.GET, url,
|
||||
body=body,
|
||||
adding_headers={
|
||||
'Content-Type': 'application/json',})
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
'Content-Type': 'application/json', })
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
test_client = Client('1', endpoint=endpoint, token='1', timeout=10)
|
||||
|
||||
result = test_client.webServers.list('1', 'test')
|
||||
|
|
|
@ -21,15 +21,16 @@ import muranoclient.v1.environments as environments
|
|||
import muranoclient.v1.services as services
|
||||
import muranoclient.v1.sessions as sessions
|
||||
|
||||
|
||||
def my_mock(*a, **b):
|
||||
return [a, b]
|
||||
|
||||
|
||||
LOG = logging.getLogger('Unit tests')
|
||||
api = MagicMock(json_request=my_mock)
|
||||
|
||||
|
||||
class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
||||
|
||||
def test_create_client_instance(self):
|
||||
|
||||
endpoint = 'http://no-resolved-host:8001'
|
||||
|
@ -117,7 +118,7 @@ class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
|||
result = manager.get('test')
|
||||
## WTF?
|
||||
assert result.manager is not None
|
||||
|
||||
|
||||
def test_env(self):
|
||||
environment = environments.Environment(api, api)
|
||||
assert environment.data() is not None
|
||||
|
@ -230,7 +231,7 @@ class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
|||
except TypeError:
|
||||
pass
|
||||
assert result == 'Exception'
|
||||
|
||||
|
||||
def test_iis_manager_list_with_one_parameter(self):
|
||||
manager = services.WebServerManager(api)
|
||||
result = manager.list('datacenter1')
|
||||
|
@ -344,11 +345,11 @@ class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
|||
def test_service_ad(self):
|
||||
service_ad = services.ActiveDirectory(api, api)
|
||||
assert service_ad.data() is not None
|
||||
|
||||
|
||||
def test_service_iis(self):
|
||||
service_iis = services.ActiveDirectory(api, api)
|
||||
assert service_iis.data() is not None
|
||||
|
||||
|
||||
def test_session_manager_list(self):
|
||||
manager = sessions.SessionManager(api)
|
||||
result = manager.list('datacenter1')
|
||||
|
@ -396,13 +397,13 @@ class UnitTestsForClassesAndFunctions(unittest.TestCase):
|
|||
except TypeError:
|
||||
pass
|
||||
assert result == 'Exception'
|
||||
|
||||
|
||||
def test_session_manager_get(self):
|
||||
manager = sessions.SessionManager(api)
|
||||
result = manager.get('datacenter1', 'session1')
|
||||
# WTF?
|
||||
assert result.manager is not None
|
||||
|
||||
|
||||
def test_session_manager_configure(self):
|
||||
manager = sessions.SessionManager(api)
|
||||
result = manager.configure('datacenter1')
|
||||
|
|
14
tox.ini
14
tox.ini
|
@ -1,5 +1,5 @@
|
|||
[tox]
|
||||
envlist = py27,pep8
|
||||
envlist = py27,pep8,pep8,pyflakes
|
||||
|
||||
[testenv]
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
|
@ -44,3 +44,15 @@ commands = nosetests --cover-erase --cover-package=muranoclient --with-xcoverage
|
|||
deps = file://{toxinidir}/.cache.bundle
|
||||
setenv = NOSE_WITH_XUNIT=1
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:pyflakes]
|
||||
deps = flake8
|
||||
commands = flake8
|
||||
|
||||
[flake8]
|
||||
# H301 one import per line
|
||||
# H302 import only modules
|
||||
ignore = H301,H302,F401
|
||||
show-source = true
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools
|
||||
|
|
Loading…
Reference in New Issue