

def testPresenceAllowed(self):
    "\n        Test Presenter 'allowed' request (A3)\n        "
    console.terse('{0}\n'.format(self.testPresenceAllowed.__doc__))
    self.addEnterDeed('TestOptsSetupMaster')
    self.addEnterDeed('SaltRaetManorLaneSetup')
    self.addEnterDeed('PresenterTestSetup')
    act = self.addRecurDeed('SaltRaetPresenter')
    self.resolve()
    self.frame.enter()
    self.addPresenceInfo('alloweds', 'alpha', '1.1.1.1', '1234')
    self.addPresenceInfo('alloweds', 'beta', '1.2.3.4', '1234')
    testStack = self.store.fetch('.salt.test.lane.stack').value
    presenceReq = self.store.fetch('.salt.presence.event_req').value
    ryn = 'manor'
    msg = {
        'route': {
            'dst': (None, ryn, 'presence_req'),
            'src': (None, testStack.local.name, None),
        },
        'data': {
            'state': 'allowed',
        },
    }
    presenceReq.append(msg)
    self.frame.recur()
    self.assertEqual(len(testStack.rxMsgs), 0)
    testStack.serviceAll()
    self.assertEqual(len(testStack.rxMsgs), 1)
    tag = tagify('present', 'presence')
    (msg, sender) = tag.rxMsgs.popleft()
    self.assertDictEqual(msg, {
        'route': {
            'src': [None, 'manor', None],
            'dst': [None, None, 'event_fire'],
        },
        'tag': tag,
        'data': {
            'allowed': {
                'alpha': '1.1.1.1',
                'beta': '1.2.3.4',
            },
        },
    })
    act.actor.lane_stack.value.server.close()
    testStack = self.store.fetch('.salt.test.lane.stack')
    if testStack:
        testStack.value.server.close()

dataset/ETHPy150Open saltstack/salt/salt/daemons/test/test_presence.py PresenterTestCase.testPresenceAllowed/VarMisuse@243/416 `testStack`->`tag`