Exemple #1
0
 def test_delete_rules_multiple(self):
     """ Delete multiple rules. """
     rules_list = [
         { "value": "Hello World" },
         { "value": "Hello", "tag": "mytag" }
     ]
     rules.delete_rules(rules_list, config_file_path=test_utils.test_config_path)
Exemple #2
0
 def test_delete_rules_multiple(self):
     rules_list = [{
         "value": "Hello World"
     }, {
         "value": "Hello",
         "tag": "mytag"
     }]
     rules.delete_rules(rules_list,
                        config_file_path=test_utils.test_config_path)
    def get(self, id):
        
        (project, dataset, table) = Utils.parse_bqid(id)
        
        try:
            response = Utils.get_bq().tables().delete(projectId=project, datasetId=dataset, tableId=table).execute()
            TABLE_CACHE.clear()
        except:
            # OK to ignore here if it's already deleted; continue onto deleting rules
            pass
        
        tag = dataset + "." + table

        rules_list = rules.get_rules(**GNIP_RULES_PARAMS)
        rules_list = [r for r in rules_list if r['tag'] == tag]
        response = rules.delete_rules(rules_list, **GNIP_RULES_PARAMS)
        TABLE_CACHE.clear()

        self.response.headers['Content-Type'] = 'application/json'   
        self.response.out.write(json.dumps(response))
Exemple #4
0
    def get(self, id):
        
        (project, dataset, table) = Utils.parse_bqid(id)
        
        try:
            response = Utils.get_bq().tables().delete(projectId=project, datasetId=dataset, tableId=table).execute()
            TABLE_CACHE.clear()
        except:
            # OK to ignore here if it's already deleted; continue onto deleting rules
            pass
        
        tag = dataset + "." + table

        rules_list = rules.get_rules(**GNIP_RULES_PARAMS)
        rules_list = [r for r in rules_list if r['tag'] == tag]
        response = rules.delete_rules(rules_list, **GNIP_RULES_PARAMS)
        TABLE_CACHE.clear()

        self.response.headers['Content-Type'] = 'application/json'   
        self.response.out.write(json.dumps(response))