def test_get_mail_vhosts(): assert get_mail_vhosts() == { MailVirtualHost('staff', 'dev-vhost.ocf.berkeley.edu'), MailVirtualHost('staff', 'dev-dev-vhost.ocf.berkeley.edu'), MailVirtualHost('ckuehl', 'ckuehl.berkeley.edu'), MailVirtualHost('daradib', 'daradib.wat'), }
def main(): user = '******' password = getpass.getpass('enter password for {}: '.format(user)) with get_connection(user, password) as c: for vhost in get_mail_vhosts(): print('{vhost.domain} ({vhost.user}):'.format(vhost=vhost)) print('=' * 50) for addr in vhost.get_forwarding_addresses(c): print(' {}'.format(addr)) print()
def test_mail_vhosts(): mail_vhosts = get_mail_vhosts() # Make sure we're actually getting some app vhosts back assert(any(mail_vhosts)) # Check that the ggroup user has some mail vhosts (these are used for # testing by OCF staff so they're likely to stick around) assert(any(vhosts_for_user('ggroup'))) # Check that dev-vhost.o.b.e exists as an mail vhost (this is used for # testing by OCF staff, so it's likely to stick around) assert( 'dev-vhost.ocf.berkeley.edu' in {vhost.domain for vhost in mail_vhosts} )