Remove objects.registry.py

objects class can be obtained from its module, so now objects doesn't
need registry.

Change-Id: Ia982a345c7b231b753a71f8f6a030490fec0d5a2
This commit is contained in:
OTSUKA, Yuanying 2014-12-26 09:20:40 +09:00
parent f2a657eefe
commit c80a80fe2b
3 changed files with 0 additions and 60 deletions

View File

@ -1,29 +0,0 @@
# Copyright 2013 Red Hat, Inc.
#
# 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.
class Registry(object):
impls = dict()
"""Allow domain objects to be loaded by name."""
def __getattr__(self, name):
return self.impls[name]
def add(self, interface, cls):
"""Register an implementation for a class."""
self.impls[interface.__name__] = cls
def clear(self):
"""Deregister all implementations."""
self.impls.clear()

View File

@ -21,7 +21,6 @@ from magnum.tests import utils
class TestBay(base.BaseTestCase):
def setUp(self):
super(TestBay, self).setUp()
# self.db = self.useFixture(utils.Database())
self.ctx = utils.dummy_context()
self.data = [{'uuid': 'ce43e347f0b0422825245b3e5f140a81cef6e65b',
@ -29,17 +28,3 @@ class TestBay(base.BaseTestCase):
'type': 'virt',
'ip_address': '10.0.0.3',
'external_ip_address': '192.0.2.3'}]
# utils.create_models_from_data(bay.Bay, self.data, self.ctx)
#
# def test_objects_registered(self):
# self.assertTrue(registry.Bay)
# self.assertTrue(registry.BayList)
#
# def test_get_all(self):
# lst = bay.BayList()
# self.assertEqual(1, len(lst.get_all(self.ctx)))
#
# def test_check_data(self):
# ta = bay.Bay().get_by_id(self.ctx, self.data[0]['id'])
# for key, value in self.data[0].items():
# self.assertEqual(value, getattr(ta, key))

View File

@ -21,7 +21,6 @@ from magnum.tests import utils
class TestContainer(base.BaseTestCase):
def setUp(self):
super(TestContainer, self).setUp()
# self.db = self.useFixture(utils.Database())
self.ctx = utils.dummy_context()
self.data = [{'uuid': 'ce43e347f0b0422825245b3e5f140a81cef6e65b',
@ -31,18 +30,3 @@ class TestContainer(base.BaseTestCase):
'command': ['echo', 'Hello World!'],
'ports': [{"container_port": 80, "host_port": 8080}],
'env': {'FOO': 'BAR'}}]
# utils.create_models_from_data(container.Container, self.data,
# self.ctx)
# def test_objects_registered(self):
# self.assertTrue(registry.Container)
# self.assertTrue(registry.ContainerList)
#
# def test_get_all(self):
# lst = container.ContainerList()
# self.assertEqual(1, len(lst.get_all(self.ctx)))
#
# def test_check_data(self):
# ta = container.Container().get_by_id(self.ctx, self.data[0]['id'])
# for key, value in self.data[0].items():
# self.assertEqual(value, getattr(ta, key))