

def test_unregister(self):
    api = Api()
    api.register(NoteResource())
    api.register(UserResource(), canonical=False)
    self.assertEqual(sorted(api._registry.keys()), ['notes', 'users'])
    self.assertEqual(len(api._canonicals), 1)
    api.unregister('users')
    self.assertEqual(len(api._registry), 1)
    self.assertEqual(sorted(api._registry.keys()), ['notes'])
    self.assertEqual(len(api._canonicals), 1)
    api.unregister('notes')
    self.assertEqual(len(api._registry), 0)
    self.assertEqual(sorted(api._registry.keys()), [])
    api.unregister('users')
    self.assertEqual(len(api._registry), 0)
    self.assertEqual(sorted(api._registry.keys()), [])

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