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)
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)
def test_validate_microblogging_schema_with_references(self): self.schema_skeleton['references'] = ['', 'foo.1'] self.assertTrue(validate_microblogging_schema(self.schema_skeleton))
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))
def test_validate_microblogging_schema_skeleton(self): self.assertTrue(validate_microblogging_schema(self.schema_skeleton))
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))
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))
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))
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)
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))
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))
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))