Exemplo n.º 1
0
    def test_get_events(self):
        for e in events:
            self.default_dao.add_meta(EventMeta.from_dict(e))
            self.custom_dao.add_meta(EventMeta.from_dict(e))

        url = "/platform/events?auth={}".format(Auth_Code)
        response = self.fetch(url)
        res = json.loads(response.body)
        self.assertEqual(res['status'], 0)
        self.assertEqual(res['msg'], 'ok')
        self.assertEqual(len(res['values']), 1)
Exemplo n.º 2
0
    def test_delete_events(self):
        for e in events:
            self.default_dao.add_meta(EventMeta.from_dict(e))
            self.custom_dao.add_meta(EventMeta.from_dict(e))

        url = "/platform/events?auth={}".format(Auth_Code)
        response = self.fetch(url, method='DELETE')
        res = json.loads(response.body)
        self.assertEqual(res['status'], 0)
        self.assertEqual(res['msg'], 'ok')
        self.assertEqual(self.custom_dao.count(), 0)
    def test_delete_event(self):
        for e in events:
            self.event_dao.add_meta(EventMeta.from_dict(e))

        url = "/default/events/event/{}/{}?auth={}".format(
            events[0]['app'], events[0]['name'], Auth_Code)
        response = self.fetch(url, method='DELETE')
        res = json.loads(response.body)
        self.assertEqual(res['status'], 0)
        self.assertEqual(res['msg'], 'ok')
        self.assertEqual(self.event_dao.count(), 0)
    def test_get_event(self):
        for e in events:
            self.event_dao.add_meta(EventMeta.from_dict(e))

        url = "/default/events/event/{}/{}?auth={}".format(
            events[0]['app'], events[0]['name'], Auth_Code)
        response = self.fetch(url)
        res = json.loads(response.body)
        self.assertEqual(res['status'], 0)
        self.assertEqual(res['msg'], 'ok')
        self.assertEqual(len(res['values']), 1)
Exemplo n.º 5
0
    def test_add_events(self):
        for e in events:
            self.default_dao.add_meta(EventMeta.from_dict(e))

        url = "/platform/events?auth={}".format(Auth_Code)
        post_args = json.dumps(events)
        response = self.fetch(url, method='POST', body=post_args)
        res = json.loads(response.body)
        self.assertEqual(res['status'], 0)
        self.assertEqual(res['msg'], 'ok')
        self.assertEqual(self.custom_dao.count(), 1)