aboutsummaryrefslogtreecommitdiff
path: root/tests/TestComponentRegistry.py
blob: 9de1a32378c3ecd6daa086300184782386a6a710 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import unittest
import util.ComponentRegistry as compReg
from operationscore.SmootCoreObject import SmootCoreObject 
class TestComponentRegistry(unittest.TestCase):
    def setUp(self):
        compReg.initRegistry()

    def tearDown(self):
        compReg.clearRegistry()
    
    def test_register_component_id_specified(self):
        comp = SmootCoreObject({'Id': 'obj1'})
        compReg.registerComponent(comp)
        newcomp = compReg.getComponent('obj1')
        assert comp == newcomp
    
    def test_register_new_id(self):
        comp = SmootCoreObject({})
        cid =compReg.registerComponent(comp)
        newcomp = compReg.getComponent(cid)
        assert comp == newcomp