Files
python-solumclient/solumclient/tests/v1/test_platform.py
Noorul Islam K M 83d8a2e83f Add initial solum client code
This includes:

1. A client based on oslo apiclient.
2. Platform manager for platform resource.

blueprint solum-cli

Change-Id: I4e40b7b86a498b24ec9ea1eadaf770eda611aaca
2014-01-28 19:38:03 +05:30

63 lines
2.3 KiB
Python

# Copyright 2013 - Noorul Islam K M
#
# 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.
from solumclient.openstack.common.apiclient import fake_client
from solumclient.tests import base
from solumclient.v1 import client as solumclient
from solumclient.v1 import platform
fixtures = {
'/v1': {
'GET': (
{},
{
'uri': 'http://example.com/v1',
'name': 'solum',
'type': 'platform',
'tags': ['solid'],
'project_id': '1dae5a09ef2b4d8cbf3594b0eb4f6b94',
'user_id': '55f41cf46df74320b9486a35f5d28a11',
'description': 'solum native implementation',
'implementation_version': '2014.1.1',
'assemblies_uri': 'http://example.com:9777/v1/assemblies',
'services_uri': 'http://example.com:9777/v1/services',
'components_uri': 'http://example.com:9777/v1/components',
'extenstions_uri': 'http://example.com:9777/v1/extenstions'
}
),
}
}
class PlatformManagerTest(base.TestCase):
def setUp(self):
super(PlatformManagerTest, self).setUp()
fake_http_client = fake_client.FakeHTTPClient(fixtures=fixtures)
api_client = solumclient.Client(fake_http_client)
self.mgr = platform.PlatformManager(api_client)
def test_get(self):
platform = self.mgr.get()
self.assertIn('Platform', repr(platform))
self.assertEqual(platform.uri,
'http://example.com/v1')
self.assertEqual(platform.type,
'platform')
self.assertEqual(platform.project_id,
'1dae5a09ef2b4d8cbf3594b0eb4f6b94')
self.assertEqual(platform.user_id,
'55f41cf46df74320b9486a35f5d28a11')