def test_send_with_attachment(self): ent = Enterprise.find_all()[0] comp = Company.find_all(ent.enterprise_id)[0] mail = UserMail(comp.default_campaign) rand_subj = random.random() mail.send('*****@*****.**', 'test %s' % rand_subj, 'This is generated by pvscore/tests/functional/test_mail:test_send_with_attachment', 'README.md')
def test_send_with_bad_attachment(self): ent = Enterprise.find_all()[0] comp = Company.find_all(ent.enterprise_id)[0] mail = UserMail(comp.default_campaign) rand_subj = random.random() excepted = False try: mail.send('*****@*****.**', 'test %s' % rand_subj, 'this should never make it. bogus attachment.', 'BOGUS.txt') except IOError as ioe: excepted = True assert excepted
def _edit_impl(self, user_id=None): user = priv = None if user_id: user = self.request.ctx.user if self.request.ctx.user.user_id == user_id else Users.load(user_id) priv = user.priv if user.priv else UserPriv() else: user = Users() priv = UserPriv() return { 'enterprises' : util.select_list(Enterprise.find_all(), 'enterprise_id', 'name', True), 'user_types': Users.get_user_types(), 'vendors' : util.select_list(Vendor.find_all(self.enterprise_id), 'vendor_id', 'name', True), 'timezones' : country_timezones('US'), 'user' : user, 'priv' : priv }
def list_enterprises(self): return {'enterprises' : Enterprise.find_all()}
def get_prods(self): ent = Enterprise.find_all()[0] prods = Product.find_all(ent.enterprise_id) assert len(prods) > 0 return prods