add new key_type table

* single-column static data table that currently contains two types: 'normal' and 'team'
* key_type foreign-keyed from api_keys
  - must be not null
  - existing rows set to 'normal'
* key_type foreign-keyed from notifications
  - nullable
  - existing rows set to null
* api_key foreign-keyed from notifications
  - nullable
  - existing rows set to null
This commit is contained in:
Leo Hemsted
2016-06-23 16:45:20 +01:00
parent f371c393a2
commit e9482c7fe1
10 changed files with 123 additions and 25 deletions

View File

@@ -18,7 +18,8 @@ from app.models import (
Permission,
ProviderStatistics,
ProviderDetails,
NotificationStatistics)
NotificationStatistics,
KEY_TYPE_NORMAL)
from app.dao.users_dao import (save_model_user, create_user_code, create_secret_code)
from app.dao.services_dao import (dao_create_service, dao_add_user_to_service)
from app.dao.templates_dao import dao_create_template
@@ -229,10 +230,11 @@ def sample_email_template_with_placeholders(notify_db, notify_db_session):
@pytest.fixture(scope='function')
def sample_api_key(notify_db,
notify_db_session,
service=None):
service=None,
key_type=KEY_TYPE_NORMAL):
if service is None:
service = sample_service(notify_db, notify_db_session)
data = {'service': service, 'name': uuid.uuid4(), 'created_by': service.created_by}
data = {'service': service, 'name': uuid.uuid4(), 'created_by': service.created_by, 'key_type': key_type}
api_key = ApiKey(**data)
save_model_api_key(api_key)
return api_key