def test_get_variables(self):
        for v in variables:
            self.default_dao.add_meta(VariableMeta.from_dict(v))
            self.custom_dao.add_meta(VariableMeta.from_dict(v))

        v = variables[0]
        url = "/platform/variables?app={}&type={}&name={}&modules={}&internal={}&auth={}".format(
            v['app'], v['type'], v['name'], v['module'],
            "true" if v['internal'] else "false", 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)
Exemple #2
0
 def test_delete_variables(self):
     for v in variables:
         self.variable_dao.add_meta(VariableMeta.from_dict(v))
     url = "/default/variables?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.variable_dao.count(), 0)
    def test_get_variable(self):
        for v in variables:
            self.custom_dao.add_meta(VariableMeta.from_dict(v))

        url = "/platform/variables/variable/{}/{}?auth={}".format(
            variables[0]['app'], variables[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)
    def test_delete_variable(self):
        for v in variables:
            self.custom_dao.add_meta(VariableMeta.from_dict(v))

        url = "/platform/variables/variable/{}/{}?auth={}".format(
            variables[0]['app'], variables[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.custom_dao.count(), 0)