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).uid account.owner_id = choice(self.users).uid self.db.session.add(account) self.accounts_map[line['Name']] = account
def test_audit_bis(self): eq_(0, len(AuditEntry.query.all())) account = Account(name="John SARL") self.session.add(account) self.session.commit() eq_(1, len(AuditEntry.query.all())) account.address_country = u"FR" self.session.commit() eq_(2, len(AuditEntry.query.all())) self.session.delete(account) self.session.commit() eq_(3, len(AuditEntry.query.all()))
def test_account(self): account = Account(name="John SARL") self.check_editable(account) d = account.to_dict() j = account.to_json()