Esempio n. 1
0
    def __init__(self, *args, **kwargs):

        # create unique uid for this application
        self.uid = uuid.uuid4().hex

        # PUB/SUB manager class
        self.pubsub = BasePubSub(self)

        # initialize dict to keep administrator's connections
        self.admin_connections = {}

        # initialize dict to keep client's connections
        self.connections = {}

        # dict to keep ping from nodes
        # key - node address, value - timestamp of last ping
        self.nodes = {}

        # application structure manager (projects, namespaces etc)
        self.structure = None

        # application state manager
        self.state = None

        # initialize dict to keep back-off information for projects
        self.back_off = {}

        # list of coroutines that must be done before message publishing
        self.pre_publish_callbacks = []

        # list of coroutines that must be done after message publishing
        self.post_publish_callbacks = []

        # initialize tornado's application
        super(Application, self).__init__(*args, **kwargs)
Esempio n. 2
0
    def setUp(self):
        self.application = Application()
        self.pubsub = BasePubSub(self.application)

        self.project_id = 'test'
        self.namespace = 'test'
        self.channel = 'test'
Esempio n. 3
0
 def setUp(self):
     super(ClientTest, self).setUp()
     self.client = TestClient(FakeSock(), {})
     self.client.is_authenticated = True
     self.client.project_id = "test_project"
     self.client.uid = "test_uid"
     self.client.user = "******"
     self.client.channels = {}
     self.client.presence_ping = FakePeriodic()
     self.client.application = Application()
     self.client.application.pubsub = BasePubSub(self.client.application)
     self.client.application.state = FakeState()