

def test_canonical_resource_for(self):
    api = Api()
    note_resource = NoteResource()
    user_resource = UserResource()
    api.register(note_resource)
    api.register(user_resource)
    self.assertEqual(len(api._canonicals), 2)
    self.assertEqual(isinstance(api.canonical_resource_for('notes'), NoteResource), True)
    api_2 = Api()
    api.unregister(user_resource._meta.resource_name)
    self.assertRaises(NotRegistered, api.canonical_resource_for, 'users')

dataset/ETHPy150Open mozilla/inventory/vendor-local/src/django-tastypie/tests/core/tests/api.py ApiTestCase.test_canonical_resource_for/original