Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Refresh settings after each test
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitpaulk committed Apr 4, 2016
1 parent 47558a5 commit 16e42d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions gratipay/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
tell_sentry = website.tell_sentry = gratipay.wireup.make_sentry_teller(env)
website.db = gratipay.wireup.db(env)
website.mailer = gratipay.wireup.mail(env, website.project_root)
gratipay.wireup.settings(website.db)
gratipay.wireup.base_url(website, env)
gratipay.wireup.secure_cookies(env)
gratipay.wireup.billing(env)
Expand Down
3 changes: 2 additions & 1 deletion gratipay/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def clear_tables(self):
except (IntegrityError, InternalError):
tablenames.insert(0, tablename)
self.db.run("ALTER SEQUENCE participants_id_seq RESTART WITH 1")
self.db.run("INSERT INTO settings DEFAULT VALUES")

gratipay.wireup.settings(self.db)


def make_elsewhere(self, platform, user_id, user_name, **kw):
Expand Down
8 changes: 5 additions & 3 deletions gratipay/wireup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ def db(env):
db.register_model(model)
gratipay.billing.payday.Payday.db = db

from gratipay.billing.exchanges import MINIMUM_CHARGE
db.run('UPDATE settings SET minimum_charge=%s', (MINIMUM_CHARGE,))

return db

def settings(db):
from gratipay.billing.exchanges import MINIMUM_CHARGE
db.run('DELETE FROM settings')
db.run('INSERT INTO settings VALUES (%s)', (MINIMUM_CHARGE, ))

def mail(env, project_root='.'):
Participant._mailer = mandrill.Mandrill(env.mandrill_key)
emails = {}
Expand Down

0 comments on commit 16e42d8

Please sign in to comment.