#NEWLINE# def test_unregister( self ) : #NEWLINE# #INDENT# 'Tests if model class is successfully unregistered from moderation' #NEWLINE# from django.db.models import signals #NEWLINE# old_pre_save_receivers = [ r for r in signals . pre_save . receivers ] #NEWLINE# old_post_save_receivers = [ r for r in signals . post_save . receivers ] #NEWLINE# signals . pre_save . receivers = [ ] #NEWLINE# signals . post_save . receivers = [ ] #NEWLINE# self . moderation . register ( UserProfile ) #NEWLINE# self . assertNotEqual ( signals . pre_save . receivers , [ ] ) #NEWLINE# self . assertNotEqual ( signals . post_save . receivers , [ ] ) #NEWLINE# UserProfile ( description = 'Profile for new user' , url = 'http://www.yahoo.com' , user = User . objects . get ( username = 'user1' ) ) . save ( ) #NEWLINE# self . moderation . unregister ( UserProfile ) #NEWLINE# self . assertEqual ( signals . pre_save . receivers , [ ] ) #NEWLINE# self . assertEqual ( signals . post_save . receivers , [ ] ) #NEWLINE# self . assertEqual ( UserProfile . objects . __class__ , Manager ) #NEWLINE# self . assertEqual ( hasattr ( UserProfile , 'moderated_object' ) , False ) #NEWLINE# signals . pre_save . receivers = old_pre_save_receivers #NEWLINE# signals . post_save . receivers = old_post_save_receivers #NEWLINE# UserProfile . objects . get ( user__username = 'user1' ) #NEWLINE# User . objects . get ( username = 'moderator' ) #NEWLINE# management . call_command ( 'loaddata' , 'test_moderation.json' , verbosity = 0 )