<s> from django . test . testcases import TestCase <EOL> from rulez import registry <EOL> from rulez . exceptions import NonexistentFieldName <EOL> class MockModel ( ) : <EOL> pk = <NUM_LIT> <EOL> def mock_permission ( self ) : <EOL> return True <EOL> class MockUser ( ) : <EOL> def __init__ ( self ) : <EOL> self . pk = <NUM_LIT> <EOL> def is_anonymous ( self ) : <EOL> return False <EOL> class RegistryTestCase ( TestCase ) : <EOL> def test_rule_is_registered ( self ) : <EOL> registry . register ( '<STR_LIT>' , MockModel ) <EOL> res = registry . get ( '<STR_LIT>' , MockModel ) <EOL> self . assertNotEqual ( res , None ) <EOL> self . assertNotEqual ( res , { } ) <EOL> def test_registration_raises_non_existant_field_names ( self ) : <EOL> self . assertRaises ( NonexistentFieldName , registry . register , <EOL> '<STR_LIT>' , MockModel , field_name = '<STR_LIT>' <EOL> ) </s>
