Implement a JWT header into base client

- adds a base client
- adds a notifications client

These do not proxy onto genuine methods. This pull request is the basic implication of the API Client. Still needs a few things before is ready, notably proper logging and actual API endpoints to hook into.

Basic premise is to deliver the JWT tokens required for Notify API authentication so we can discuss the implementation/premise.
This commit is contained in:
Martyn Inglis
2015-12-11 16:57:00 +00:00
parent e25ca0e434
commit 6deaa61011
11 changed files with 256 additions and 7 deletions

31
tests/conftest.py Normal file
View File

@@ -0,0 +1,31 @@
import pytest
import mock
from app import create_app
from config import configs
@pytest.fixture(scope='session')
def notify_api(request):
app = create_app('test')
ctx = app.app_context()
ctx.push()
def teardown():
ctx.pop()
request.addfinalizer(teardown)
return app
@pytest.fixture(scope='function')
def notify_config(notify_api):
notify_api.config['NOTIFY_API_ENVIRONMENT'] = 'test'
notify_api.config.from_object(configs['test'])
@pytest.fixture(scope='function')
def os_environ(request):
env_patch = mock.patch('os.environ', {})
request.addfinalizer(env_patch.stop)
return env_patch.start()