Example #1
0
 def test_validate_microblogging_schema_fails_for_missing_entries(self):
     entries = self.schema_skeleton.keys()
     for e in entries:
         schema = dict(self.schema_skeleton)
         del schema[e]
         with self.assertRaisesRegexp(AssertionError, e):
             validate_microblogging_schema(schema)
Example #2
0
 def test_validate_microblogging_schema_fails_for_missing_entries(self):
     entries = self.schema_skeleton.keys()
     for e in entries:
         schema = dict(self.schema_skeleton)
         del schema[e]
         with self.assertRaisesRegexp(AssertionError, e):
             validate_microblogging_schema(schema)
Example #3
0
 def test_validate_microblogging_schema_fails_for_wrong_datatypes(self):
     for n, e in self.wrong_schema.items():
         schema = dict(self.schema_skeleton)
         schema[n] = e
         with self.assertRaisesRegexp(AssertionError, n):
             validate_microblogging_schema(schema)
Example #4
0
 def test_validate_microblogging_schema_with_references(self):
     self.schema_skeleton['references'] = ['', 'foo.1']
     self.assertTrue(validate_microblogging_schema(self.schema_skeleton))
Example #5
0
 def test_validate_microblogging_schema_with_mentions(self):
     self.schema_skeleton['mentions'] = [self.hugo.id, self.herbert.id]
     self.assertTrue(validate_microblogging_schema(self.schema_skeleton))
Example #6
0
 def test_validate_microblogging_schema_skeleton(self):
     self.assertTrue(validate_microblogging_schema(self.schema_skeleton))
Example #7
0
 def test_validate_microblogging_schema_fails_for_unsorted_references(self):
     self.schema_skeleton['references'] = ['foo.1', '']
     with self.assertRaisesRegexp(AssertionError, "sorted"):
         self.assertTrue(validate_microblogging_schema(self.schema_skeleton))
Example #8
0
 def test_validate_microblogging_schema_fails_for_unsorted_references(self):
     self.schema_skeleton['references'] = ['foo.1', '']
     with self.assertRaisesRegexp(AssertionError, "sorted"):
         self.assertTrue(validate_microblogging_schema(
             self.schema_skeleton))
Example #9
0
 def test_validate_microblogging_schema_fails_for_duplicate_mentions(self):
     self.schema_skeleton['mentions'] = [self.hugo.id, self.hugo.id]
     with self.assertRaisesRegexp(AssertionError, "unique"):
         self.assertTrue(validate_microblogging_schema(
             self.schema_skeleton))
Example #10
0
 def test_validate_microblogging_schema_fails_for_wrong_type(self):
     schema = dict(self.schema_skeleton)
     schema['type'] = 'uncle bob'
     with self.assertRaisesRegexp(AssertionError, 'type'):
         validate_microblogging_schema(schema)
Example #11
0
 def test_validate_microblogging_schema_fails_for_wrong_datatypes(self):
     for n, e in self.wrong_schema.items():
         schema = dict(self.schema_skeleton)
         schema[n] = e
         with self.assertRaisesRegexp(AssertionError, n):
             validate_microblogging_schema(schema)
Example #12
0
 def test_validate_microblogging_schema_with_references(self):
     self.schema_skeleton['references'] = ['', 'foo.1']
     self.assertTrue(validate_microblogging_schema(self.schema_skeleton))
Example #13
0
 def test_validate_microblogging_schema_with_mentions(self):
     self.schema_skeleton['mentions'] = [self.hugo.id, self.herbert.id]
     self.assertTrue(validate_microblogging_schema(self.schema_skeleton))
Example #14
0
 def test_validate_microblogging_schema_skeleton(self):
     self.assertTrue(validate_microblogging_schema(self.schema_skeleton))
Example #15
0
 def test_validate_microblogging_schema_fails_for_wrong_type(self):
     schema = dict(self.schema_skeleton)
     schema['type'] = 'uncle bob'
     with self.assertRaisesRegexp(AssertionError, 'type'):
         validate_microblogging_schema(schema)
Example #16
0
 def test_validate_microblogging_schema_fails_for_unsorted_mentions(self):
     self.schema_skeleton['mentions'] = [self.herbert.id, self.hugo.id]
     with self.assertRaisesRegexp(AssertionError, "sorted"):
         self.assertTrue(validate_microblogging_schema(self.schema_skeleton))
Example #17
0
 def test_validate_microblogging_schema_fails_for_duplicate_mentions(self):
     self.schema_skeleton['mentions'] = [self.hugo.id, self.hugo.id]
     with self.assertRaisesRegexp(AssertionError, "unique"):
         self.assertTrue(validate_microblogging_schema(self.schema_skeleton))
Example #18
0
 def test_validate_microblogging_schema_fails_for_unsorted_mentions(self):
     self.schema_skeleton['mentions'] = [self.herbert.id, self.hugo.id]
     with self.assertRaisesRegexp(AssertionError, "sorted"):
         self.assertTrue(validate_microblogging_schema(
             self.schema_skeleton))