def test_invalid_reserved_name(self): with self.assertRaises(HTTPException) as raised: rh._validate_internal_name('foo' + rh.RESERVED) e = raised.exception self.assertEqual(e.status_int, 400) self.assertEqual(str(e), '400 Bad Request') self.assertEqual(e.body, b"Invalid reserved-namespace name")
def test_validate_internal_name(self): self.assertIsNone(rh._validate_internal_name('foo')) self.assertIsNone( rh._validate_internal_name(rh.get_reserved_name('foo'))) self.assertIsNone( rh._validate_internal_name(rh.get_reserved_name('foo', 'bar'))) self.assertIsNone(rh._validate_internal_name('')) self.assertIsNone(rh._validate_internal_name(rh.RESERVED))