@pytest.mark.cmd
@pytest.mark.django_db
def test_cmd_contributors_mailmerge(capfd, dummy_email_contributors):
 call_command('contributors', '--mailmerge')
 (out, err) = capfd.readouterr()
 temp = OrderedDict(sorted(CONTRIBUTORS_WITH_EMAIL.items(), key=(lambda x: str.lower(x[1]['username']))))
 expected = [formataddr(((item['full_name'].strip() or item['username']), item['email'].strip())) for item in temp.values() if item['email'].strip()]
 assert (out.strip() == '\n'.join(expected))

@ pytest . mark . cmd @ pytest . mark . django_db def test_cmd_contributors_mailmerge ( capfd , dummy_email_contributors ) : call_command ( 'contributors' , '--mailmerge' ) ( out , err ) = capfd . readouterr ( ) temp = OrderedDict ( sorted ( CONTRIBUTORS_WITH_EMAIL . items ( ) , key = ( lambda x : str . lower ( x [ 1 ] [ 'username' ] ) ) ) ) expected = [ formataddr ( ( ( item [ 'full_name' ] . strip ( ) or item [ 'username' ] ) , item [ 'email' ] . strip ( ) ) ) for item in temp . values ( ) if item [ 'email' ] . strip ( ) ] assert ( out . strip ( ) == '\n' . join ( expected ) )
contributors across the site with mailmerge .