Esempio n. 1
0
    def test_subscribe(self):
        """Test subscription registration."""
        api = state.RunningAPI()
        self.assertEquals([('/running', 'foo.bar#*')],
                          api.subscribe({'filter': 'foo.bar'}))

        self.assertEquals([('/running', '*#*')], api.subscribe({'filter':
                                                                '*'}))
Esempio n. 2
0
    def test_on_event(self):
        """Tests payload generation."""
        api = state.RunningAPI()
        self.assertEqual(
            {
                'host': 'xxx',
                'topic': '/running',
                'name': 'foo.bar#1234'
            }, api.on_event('/running/foo.bar#1234', None, 'xxx'))

        self.assertEqual(
            {
                'host': None,
                'topic': '/running',
                'name': 'foo.bar#1234'
            }, api.on_event('/running/foo.bar#1234', 'd', None))