<s> from django . test import TestCase <EOL> from django . contrib . auth . models import User <EOL> from django . contrib . contenttypes . models import ContentType <EOL> from . models import Demo <EOL> from . . utils import _allowed , get_config , per_model_perm_check <EOL> class UtilsTestCase ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . content_type = ContentType . objects . get ( model = "<STR_LIT:user>" ) <EOL> def test_allowed_model ( self ) : <EOL> self . assertTrue ( _allowed ( User ) ) <EOL> def test_allowed_str ( self ) : <EOL> self . assertTrue ( _allowed ( "<STR_LIT>" ) ) <EOL> def test_allowed_other ( self ) : <EOL> self . assertFalse ( _allowed ( TestCase ) ) <EOL> def test_get_config ( self ) : <EOL> config = get_config ( User ) <EOL> self . assertEquals ( config [ "<STR_LIT>" ] , "<STR_LIT>" ) <EOL> def test_per_model_perm_check ( self ) : <EOL> patrick = User . objects . create_user ( username = "<STR_LIT>" ) <EOL> check = per_model_perm_check ( patrick , User ) <EOL> self . assertTrue ( check ) <EOL> def test_per_model_perm_check_default ( self ) : <EOL> patrick = User . objects . create_user ( username = "<STR_LIT>" ) <EOL> check = per_model_perm_check ( patrick , Demo ) <EOL> self . assertTrue ( check ) </s>
