<s> from django . test import TestCase <EOL> from mock import Mock <EOL> from lazysignup . models import LazyUser <EOL> class LazyUserManagerTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_generate_username_no_method ( self ) : <EOL> """<STR_LIT>""" <EOL> mock_user_class = Mock ( generate_username = <NUM_LIT:1> ) <EOL> del mock_user_class . generate_username <EOL> mock_user_class . _meta . get_field . return_value . max_length = <NUM_LIT:32> <EOL> username = LazyUser . objects . generate_username ( mock_user_class ) <EOL> self . assertEqual ( len ( username ) , <NUM_LIT:32> ) <EOL> def test_generate_username_has_method ( self ) : <EOL> """<STR_LIT>""" <EOL> mock_user_class = Mock ( ) <EOL> mock_user_class . generate_username . return_value = '<STR_LIT>' <EOL> username = LazyUser . objects . generate_username ( mock_user_class ) <EOL> mock_user_class . generate_username . assert_called_once_with ( ) <EOL> self . assertEqual ( username , '<STR_LIT>' ) </s>
