def load_accounts(self): reader = self.get_reader("Accounts.csv") for line in reader: d = {} for col in ['Name', 'Website', 'Office Phone', 'Type', 'Industry']: d[col.lower().replace(" ", "_")] = line[col] for k in ['Street', 'City', 'State', 'Country']: d["address_" + k.lower()] = line["Billing %s" % k] if d['website'] and not d['website'].startswith("http://"): d['website'] = "http://" + d['website'] account = Account(**d) account.creator_id = choice(self.users).id account.owner_id = choice(self.users).id db.session.add(account) self.accounts_map[line['Name']] = account
def test_account(self): account = Account(name="John SARL") self.check_editable(account) d = account.to_dict() j = account.to_json()