コード例 #1
0
ファイル: test_helpers.py プロジェクト: tolteck/stripe-hooks
    def test_load_configuration_incomplete(self):
        "Raises proper errors for an incomplete configuration"

        temp_file = tempfile.NamedTemporaryFile()
        test_conf = {
            "business": {
                "name": "Foo Bar",
                "notification_address": "*****@*****.**"
            }
        }
        temp_file.write(json.dumps(test_conf))
        temp_file.seek(0)

        with pytest.raises(Exception):
            load_configuration(temp_file.name)
コード例 #2
0
ファイル: test_helpers.py プロジェクト: frankamp/stripe-hooks
    def test_load_configuration_incomplete(self):
        "Raises proper errors for an incomplete configuration"

        temp_file = tempfile.NamedTemporaryFile()
        test_conf = {
            "business": {
                "name": "Foo Bar",
                "notification_address": "*****@*****.**"
            }
        }
        temp_file.write(json.dumps(test_conf))
        temp_file.seek(0)

        with pytest.raises(Exception):
            load_configuration(temp_file.name)
コード例 #3
0
 def setup_method(self, method):
     app.config['TESTING'] = True
     app.config['DEBUG'] = True
     app.config['email'] = load_configuration(
         os.path.join("test/fixtures/", "configuration.json"))
     # Attach the client
     self.client = app.test_client()
     # Turn on HTTP mocking
     httpretty.enable()
コード例 #4
0
ファイル: base.py プロジェクト: frankamp/stripe-hooks
 def setup_method(self, method):
     app.config['TESTING'] = True
     app.config['DEBUG'] = True
     app.config['email'] = load_configuration(
         os.path.join("test/fixtures/", "configuration.json"))
     # Attach the client
     self.client = app.test_client()
     # Turn on HTTP mocking
     httpretty.enable()
コード例 #5
0
ファイル: test_helpers.py プロジェクト: frankamp/stripe-hooks
    def test_load_configuration(self):
        "Tests that the load_coniguration method loads the config correctly"

        temp_file = tempfile.NamedTemporaryFile()
        test_conf = {
            "business": {
                "email_address": "*****@*****.**",
                "name": "Foo Bar",
                "notification_address": "*****@*****.**"
            }
        }
        temp_file.write(json.dumps(test_conf))
        temp_file.seek(0)

        conf = load_configuration(temp_file.name)
        assert conf == test_conf
コード例 #6
0
ファイル: test_helpers.py プロジェクト: tolteck/stripe-hooks
    def test_load_configuration(self):
        "Tests that the load_coniguration method loads the config correctly"

        temp_file = tempfile.NamedTemporaryFile()
        test_conf = {
            "business": {
                "email_address": "*****@*****.**",
                "name": "Foo Bar",
                "notification_address": "*****@*****.**"
            }
        }
        temp_file.write(json.dumps(test_conf))
        temp_file.seek(0)

        conf = load_configuration(temp_file.name)
        assert conf == test_conf
コード例 #7
0
ファイル: app.py プロジェクト: nisbus/stripe-hooks
import os
from shared.helpers import load_configuration
from flask import Flask

# The instance path has to be absolute so lets get the absolute path to our
# root directory.
my_directory = os.path.dirname(__file__)
root_directory = os.path.abspath(os.path.join(my_directory, ".."))

# Create the app and configure
app = Flask(__name__,
            instance_path=root_directory,
            instance_relative_config=True)

app.config.from_pyfile("settings.py")

path = os.path.join(my_directory, "../configuration.json")

app.config["email"] = load_configuration(path)