From e2e3c0f19cc756917fc32d5d3546c406ff39ba2f Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Wed, 2 Apr 2014 15:50:41 -0400 Subject: [PATCH] Remove os.environ from wireup.billing --- configure-aspen.py | 2 +- gittip/wireup.py | 8 ++++---- tests/py/test_hooks.py | 4 ++-- tests/py/test_stats.py | 3 ++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/configure-aspen.py b/configure-aspen.py index 5d9bda7b5a..e6a9a23b2b 100644 --- a/configure-aspen.py +++ b/configure-aspen.py @@ -39,7 +39,7 @@ env = website.env = gittip.wireup.env() gittip.wireup.canonical(env) website.db = gittip.wireup.db(env) -gittip.wireup.billing() +gittip.wireup.billing(env) gittip.wireup.username_restrictions(website) gittip.wireup.nanswers(env) gittip.wireup.accounts_elsewhere(website, env) diff --git a/gittip/wireup.py b/gittip/wireup.py index cf421b3268..26119d7726 100644 --- a/gittip/wireup.py +++ b/gittip/wireup.py @@ -39,10 +39,10 @@ def db(env): return db -def billing(): - stripe.api_key= os.environ['STRIPE_SECRET_API_KEY'] - stripe.publishable_api_key= os.environ['STRIPE_PUBLISHABLE_API_KEY'] - balanced.configure(os.environ['BALANCED_API_SECRET']) +def billing(env): + stripe.api_key = env.stripe_secret_api_key + stripe.publishable_api_key = env.stripe_publishable_api_key + balanced.configure(env.balanced_api_secret) def username_restrictions(website): diff --git a/tests/py/test_hooks.py b/tests/py/test_hooks.py index de589f8fe9..29c5e82925 100644 --- a/tests/py/test_hooks.py +++ b/tests/py/test_hooks.py @@ -11,8 +11,8 @@ class Tests(Harness): def setUp(self): Harness.setUp(self) - # Grab configuration from os.environ, storing for later. - env = Environment(CANONICAL_SCHEME=unicode, CANONICAL_HOST=unicode) + # Grab configuration from the environment, storing for later. + env = wireup.env() self.environ = env.environ # Change env, doesn't change self.environ. diff --git a/tests/py/test_stats.py b/tests/py/test_stats.py index 1b66e473c3..10d7498f63 100644 --- a/tests/py/test_stats.py +++ b/tests/py/test_stats.py @@ -101,7 +101,8 @@ def test_stats_description_accurate_during_payday_run(self): with patch.object(datetime, 'datetime') as mock_datetime: mock_datetime.utcnow.return_value = a_thursday - wireup.billing() + env = wireup.env() + wireup.billing(env) payday = Payday(self.db) payday.start()