def load_leads(self): reader = self.get_reader("Leads.csv") for line in reader: d = {} d['email'] = line['Email Address'] d['job_title'] = line['Title'] for col in ['First Name', 'Last Name', 'Department', 'Account Name']: d[col.lower().replace(" ", "_")] = line[col] for k in ['Street', 'City', 'State', 'Country']: d["address_" + k.lower()] = line["Primary Address %s" % k] lead = Lead(**d) lead.creator_id = choice(self.users).uid lead.owner_id = choice(self.users).uid self.db.session.add(lead)
def test_lead(self): lead = Lead(first_name="John", last_name="Test User", email="*****@*****.**") self.check_editable(lead) d = lead.to_dict() j = lead.to_json()