def test_objectidconverter_to_python_badrequest(self): ("Test that `ObjectIDConverter.to_python()` raises " "`BadRequest`.") converter = ObjectIDConverter('/') with self.assertRaises(BadRequest): # InvalidId converter.to_python('00000000') with self.assertRaises(BadRequest): # TypeError converter.to_python(1)
def test_objectidconverter_to_url(self): """Test the `ObjectIDConverter.to_url()` method.""" converter = ObjectIDConverter('/') self.assertEqual(converter.to_url(AN_OBJECT_ID), AN_OBJECT_ID_STR)