Esempio n. 1
0
 def test_check_one_rule_extra_stuff_in_rule(self):
     l = [ { "value": "hello", "wat": "man" } ]
     try:
         rules._check_rules_list(l)
     except RulesListFormatException:
         return
     self.fail("_check_rules_list was supposed to throw a RuleFormatException")
Esempio n. 2
0
 def test_check_one_rule_typo_values(self):
     l = [ { "values": "hello" } ]
     try:
         rules._check_rules_list(l)
     except RulesListFormatException:
         return
     self.fail("_check_rules_list was supposed to throw a RuleFormatException")
Esempio n. 3
0
 def test_check_one_rule_typo_tag(self):
     l = [{"value": "hello", "tags": "t"}]
     try:
         rules._check_rules_list(l)
     except RulesListFormatException:
         return
     self.fail(
         "_check_rules_list was supposed to throw a RuleFormatException")
Esempio n. 4
0
 def test_check_one_rule_extra_stuff_in_rule(self):
     l = [{"value": "hello", "wat": "man"}]
     try:
         rules._check_rules_list(l)
     except RulesListFormatException:
         return
     self.fail(
         "_check_rules_list was supposed to throw a RuleFormatException")
Esempio n. 5
0
 def test_check_one_rule_typo_tag(self):
     """ Make sure incorrectly formatted rule tags fail. """
     l = [ { "value": "hello", "tags": "t" } ]
     try:
         rules._check_rules_list(l)
     except RulesListFormatException:
         return
     self.fail("_check_rules_list was supposed to throw a RuleFormatException")
Esempio n. 6
0
 def test_check_many_rules_ok(self):
     """ Check list of many rules. """
     l = [
         {"value": "hello", "id": 3},
         {"value": "goodbye", "tag": "w", "id": 4},
         {"value": "hi again", "tag": "x"},
         {"value": "bye again"}
     ]
     rules._check_rules_list(l)
Esempio n. 7
0
 def test_check_one_rule_typo_tag(self):
     """ Make sure incorrectly formatted rule tags fail. """
     l = [{"value": "hello", "tags": "t"}]
     try:
         rules._check_rules_list(l)
     except RulesListFormatException:
         return
     self.fail(
         "_check_rules_list was supposed to throw a RuleFormatException")
Esempio n. 8
0
 def test_check_many_rules_ok(self):
     """ Check list of many rules. """
     l = [{
         "value": "hello",
         "id": 3
     }, {
         "value": "goodbye",
         "tag": "w",
         "id": 4
     }, {
         "value": "hi again",
         "tag": "x"
     }, {
         "value": "bye again"
     }]
     rules._check_rules_list(l)
Esempio n. 9
0
 def test_check_many_rules_ok(self):
     l = [{"value": "hello"}, {"value": "h", "tag": "w"}]
     rules._check_rules_list(l)
Esempio n. 10
0
 def test_check_one_rule_ok(self):
     l = [{"value": "hello"}]
     rules._check_rules_list(l)
Esempio n. 11
0
 def test_build_post_object(self):
     rules_list = self._generate_rules_list()
     post_obj = rules._generate_post_object(rules_list)
     self.assertTrue("rules" in post_obj)
     rules._check_rules_list(post_obj['rules'])
Esempio n. 12
0
 def test_build_rule_with_tag(self):
     r = rules.build(self.rule_string, tag=self.tag)
     self.assertEqual(r['value'], self.rule_string)
     self.assertEqual(r['tag'], self.tag)
     rules._check_rules_list([r])
Esempio n. 13
0
 def test_build_post_object(self):
     """ Generate rules object to post. """
     rules_list = self._generate_rules_list()
     post_obj = rules._generate_post_object(rules_list)
     self.assertTrue("rules" in post_obj)
     rules._check_rules_list(post_obj['rules'])
Esempio n. 14
0
 def test_check_many_rules_ok(self):
     """ Check list of many rules. """
     l = [ { "value": "hello" }, { "value": "h", "tag": "w" }]
     rules._check_rules_list(l)
Esempio n. 15
0
 def test_check_rule_tag_none(self):
     l = [{"value": "hello", "tag": None}, {"value": "h", "tag": "w"}]
     rules._check_rules_list(l)
Esempio n. 16
0
 def test_check_one_rule_ok(self):
     """ Check list of one rule. """
     l = [{"value": "hello"}]
     rules._check_rules_list(l)
Esempio n. 17
0
 def test_check_many_rules_ok(self):
     l = [ { "value": "hello" }, { "value": "h", "tag": "w" }]
     rules._check_rules_list(l)
Esempio n. 18
0
 def test_check_one_rule_ok(self):
     l = [ { "value": "hello" } ]
     rules._check_rules_list(l)
Esempio n. 19
0
 def test_build_rule_without_tag(self):
     """ Build rule without tag. """
     r = rules.build(self.rule_string)
     self.assertEqual(r['value'], self.rule_string)
     self.assertFalse("tag" in r)
     rules._check_rules_list([r])
Esempio n. 20
0
 def test_build_rule_with_tag(self):
     """ Build rule with tag. """
     r = rules.build(self.rule_string, tag=self.tag)
     self.assertEqual(r['value'], self.rule_string)
     self.assertEqual(r['tag'], self.tag)
     rules._check_rules_list([r])
Esempio n. 21
0
 def test_build_rule_without_tag(self):
     r = rules.build(self.rule_string)
     self.assertEqual(r['value'], self.rule_string)
     self.assertFalse("tag" in r)
     rules._check_rules_list([r])
Esempio n. 22
0
 def test_check_one_rule_ok(self):
     """ Check list of one rule. """
     l = [ { "value": "hello" } ]
     rules._check_rules_list(l)
Esempio n. 23
0
 def test_check_rule_tag_none(self):
     l = [ { "value": "hello", "tag": None }, { "value": "h", "tag": "w" }]
     rules._check_rules_list(l)
Esempio n. 24
0
 def test_check_rule_tag_none(self):
     """ Check list of rules both with tag and without. """
     l = [ { "value": "hello", "tag": None }, { "value": "h", "tag": "w" }]
     rules._check_rules_list(l)
Esempio n. 25
0
 def test_check_rule_tag_none(self):
     """ Check list of rules both with tag and without. """
     l = [{"value": "hello", "tag": None}, {"value": "h", "tag": "w"}]
     rules._check_rules_list(l)