#NEWLINE# def test_raise_integrity_error_model_not_registered_with_moderation( self ) : #NEWLINE# #INDENT# m1 = ModelWithSlugField2 ( slug = 'test' ) #NEWLINE# m1 . save ( ) #NEWLINE# m1 = ModelWithSlugField2 . objects . get ( slug = 'test' ) #NEWLINE# m2 = ModelWithSlugField2 ( slug = 'test' ) #NEWLINE# if hasattr ( transaction , 'atomic' ) : #NEWLINE# #INDENT# with transaction . atomic ( ) : #NEWLINE# #INDENT# self . assertRaises ( IntegrityError , m2 . save ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . assertRaises ( IntegrityError , m2 . save ) #NEWLINE# #UNINDENT# self . assertEqual ( ModeratedObject . objects . all ( ) . count ( ) , 0 )