def test_add_one_rule_not_ok(self): """Add one rule with exception thrown. """ try: rules.add_rule(self.rule_string, self.tag, config_file_path=test_utils.test_config_path) except RuleAddFailedException: return self.fail("Rule Add was supposed to fail and throw a RuleAddException")
def test_add_many_rules_no_creds(self): """ Make sure adding rules with non-existent config fails. """ try: rules.add_rule(self.rule_string, self.tag) except ConfigFileNotFoundException: return self.fail("Rule Add was supposed to fail and throw a ConfigFileNotFoundException")
def test_add_one_rule_no_creds(self): """ Make sure adding rule without credentials fail. """ try: rules.add_rule(self.rule_string, self.tag) except ConfigFileNotFoundException: return self.fail("Rule Add was supposed to fail and throw a ConfigFileNotFoundException")
def test_add_many_rules_no_creds(self): try: rules.add_rule(self.rule_string, self.tag) except ConfigFileNotFoundException: return self.fail( "Rule Add was supposed to fail and throw a ConfigFileNotFoundException" )
def test_add_one_rule_not_ok(self): try: rules.add_rule(self.rule_string, self.tag, config_file_path=test_utils.test_config_path) except RuleAddFailedException: return self.fail("Rule Add was supposed to fail and throw a RuleAddException")
def test_add_many_rules_no_creds(self): """ Make sure adding rules with non-existent config fails. """ try: rules.add_rule(self.rule_string, self.tag) except ConfigFileNotFoundException: return self.fail( "Rule Add was supposed to fail and throw a ConfigFileNotFoundException" )
def test_add_one_rule_no_creds(self): """ Make sure adding rule without credentials fail. """ try: rules.add_rule(self.rule_string, self.tag) except ConfigFileNotFoundException: return self.fail( "Rule Add was supposed to fail and throw a ConfigFileNotFoundException" )
def get(self): rule = self.request.get("rule") tag = self.request.get("tag") if not rule or not tag: raise Exception("missing parameter") response = None try: rules.add_rule(rule, tag=tag, url=GNIP_URL, auth=(GNIP_USERNAME, GNIP_PASSWORD)) except RulesGetFailedException: pass # uh oh self.response.headers['Content-Type'] = 'application/json' self.response.out.write(json.dumps(response))
def get(self): rule = self.request.get("rule") tag = self.request.get("tag") if not rule or not tag: raise Exception("missing parameter") params = GNIP_RULES_PARAMS params['tag'] = tag response = rules.add_rule(rule, **params) TABLE_CACHE.clear() self.response.headers['Content-Type'] = 'application/json' self.response.out.write(json.dumps(response))
def get(self): response = [] type = self.request.get("type") dataset = self.request.get("dataset") if "gnip" in dataset: dataset = "gnip" schema_file = "./schema/schema_gnip.json" else: dataset = "twitter" schema_file = "./schema/schema_twitter.json" table = self.request.get("name") rule_list = self.request.get("rules") imprt = self.request.get("import") schema_str = Utils.read_file(schema_file) schema = json.loads(schema_str) Utils.insert_table(dataset, table, schema) TABLE_CACHE.clear() name = Utils.make_tag(dataset, table) rule_list = [s.strip() for s in rule_list.splitlines()] for r in rule_list: params = GNIP_RULES_PARAMS params['tag'] = name response.append(rules.add_rule(r, **params)) TABLE_CACHE.clear() self.response.headers['Content-Type'] = 'application/json' self.response.out.write(json.dumps(response))
def test_add_one_rule_ok(self): """Add one rule with config. """ rules.add_rule(self.rule_string, self.tag, config_file_path=test_utils.test_config_path)
def test_add_one_rule_ok(self): rules.add_rule(self.rule_string, self.tag, config_file_path=test_utils.test_config_path)
def test_add_many_rules_no_creds(self): try: rules.add_rule(self.rule_string, self.tag) except ConfigFileNotFoundException: return self.fail("Rule Add was supposed to fail and throw a ConfigFileNotFoundException")