<s> from django . contrib . sites . shortcuts import get_current_site <EOL> from django . core import mail <EOL> from django . test import TestCase <EOL> from connect . accounts . factories import UserFactory <EOL> from connect . config . factories import SiteFactory , SiteConfigFactory <EOL> from connect . utils import generate_unique_id , send_connect_email <EOL> class UtilsTest ( TestCase ) : <EOL> def test_generate_unique_id ( self ) : <EOL> uid = generate_unique_id ( ) <EOL> self . assertEqual ( len ( uid ) , <NUM_LIT:30> ) <EOL> self . assertRegexpMatches ( uid , '<STR_LIT>' ) <EOL> def test_can_send_connect_email ( self ) : <EOL> subject = '<STR_LIT>' <EOL> template = '<STR_LIT>' <EOL> recipient = UserFactory ( email = '<STR_LIT>' ) <EOL> site = SiteFactory ( domain = '<STR_LIT>' ) <EOL> site . config = SiteConfigFactory ( site = site ) <EOL> sender = UserFactory ( email = '<STR_LIT>' ) <EOL> url = '<STR_LIT>' <EOL> comments = '<STR_LIT>' , <EOL> logged_against = UserFactory ( email = '<STR_LIT>' ) <EOL> email = send_connect_email ( subject , template , recipient , site , sender , <EOL> url , comments , logged_against ) <EOL> self . assertEqual ( email , <NUM_LIT:1> ) </s>
