def test__oid_to_object_poskeyerror(t):
        '''oids not found in dmd are considered deletions,
        and sent straight to the output sink
        '''
        app = MagicMock(name='dmd.root', spec_set=['_p_jar'])
        app._p_jar.__getitem__.side_effect = POSKeyError()

        oid_to_obj_pipe = oid_to_obj(app, t.sink, t.out_pipe)
        oid_to_obj_pipe.send(111)

        t.sink.send.assert_called_with([111])
Ejemplo n.º 2
0
    def test__oid_to_object_poskeyerror(t):
        '''oids not found in dmd are considered deletions,
        and sent straight to the output sink
        '''
        app = MagicMock(name='dmd.root', spec_set=['_p_jar'])
        app._p_jar.__getitem__.side_effect = POSKeyError()

        oid_to_obj_pipe = oid_to_obj(app, t.sink, t.out_pipe)
        oid_to_obj_pipe.send(111)

        t.sink.send.assert_called_with([111])
    def test__oid_to_object_exclude_unsuported_types(t):
        '''Exclude any unspecified object types
        '''
        unsuported = MagicMock(name='unsuported type', __of__=Mock())
        app = sentinel.dmd_root
        app._p_jar = {111: unsuported}

        oid_to_obj_pipe = oid_to_obj(app, t.sink, t.out_pipe)
        oid_to_obj_pipe.send(111)

        t.sink.send.assert_not_called()
        t.out_pipe.send.assert_not_called()
Ejemplo n.º 4
0
    def test__oid_to_object_exclude_unsuported_types(t):
        '''Exclude any unspecified object types
        '''
        unsuported = MagicMock(name='unsuported type', __of__=Mock())
        app = sentinel.dmd_root
        app._p_jar = {111: unsuported}

        oid_to_obj_pipe = oid_to_obj(app, t.sink, t.out_pipe)
        oid_to_obj_pipe.send(111)

        t.sink.send.assert_not_called()
        t.out_pipe.send.assert_not_called()
    def test__oid_to_object_deleted_primaryaq_keyerror(t):
        '''objects without a primaryAq ar considered deletions,
        and sent straight to the output sink
        '''
        deleted = MagicMock(DeviceComponent, __of__=Mock())
        deleted.__of__.return_value.primaryAq.side_effect = KeyError
        app = sentinel.dmd_root
        app._p_jar = {111: deleted}

        oid_to_obj_pipe = oid_to_obj(app, t.sink, t.out_pipe)
        oid_to_obj_pipe.send(111)

        t.sink.send.assert_called_with([111])
    def test_oid_to_obj(t):
        device = MagicMock(PrimaryPathObjectManager, __of__=Mock())
        device_obj = sentinel.device_obj
        device.__of__.return_value.primaryAq.return_value = device_obj
        app = sentinel.dmd_root
        app.zport = sentinel.zport
        app.zport.dmd = sentinel.dmd_root
        app._p_jar = {111: device}

        oid_to_obj_pipe = oid_to_obj(app, t.sink, t.out_pipe)
        oid_to_obj_pipe.send(111)

        t.out_pipe.send.assert_called_with((111, device_obj))
Ejemplo n.º 7
0
    def test__oid_to_object_deleted_primaryaq_keyerror(t):
        '''objects without a primaryAq ar considered deletions,
        and sent straight to the output sink
        '''
        deleted = MagicMock(DeviceComponent, __of__=Mock())
        deleted.__of__.return_value.primaryAq.side_effect = KeyError
        app = sentinel.dmd_root
        app._p_jar = {111: deleted}

        oid_to_obj_pipe = oid_to_obj(app, t.sink, t.out_pipe)
        oid_to_obj_pipe.send(111)

        t.sink.send.assert_called_with([111])
Ejemplo n.º 8
0
    def test_oid_to_obj(t):
        device = MagicMock(PrimaryPathObjectManager, __of__=Mock())
        device_obj = sentinel.device_obj
        device.__of__.return_value.primaryAq.return_value = device_obj
        app = sentinel.dmd_root
        app.zport = sentinel.zport
        app.zport.dmd = sentinel.dmd_root
        app._p_jar = {111: device}

        oid_to_obj_pipe = oid_to_obj(app, t.sink, t.out_pipe)
        oid_to_obj_pipe.send(111)

        t.out_pipe.send.assert_called_with((111, device_obj))