Mapped template actions to the api and mocked tests.

This commit is contained in:
Nicholas Staples
2016-01-19 15:54:12 +00:00
parent e2f5d64695
commit cfb3f96b01
13 changed files with 321 additions and 88 deletions

View File

@@ -1,9 +1,5 @@
from flask import url_for
from datetime import datetime
from client.errors import HTTPError, InvalidResponse
from sqlalchemy.orm import load_only
from flask.ext.login import current_user
from app import (db, notifications_api_client)
from app import notifications_api_client
from app.main.utils import BrowsableItem

View File

@@ -0,0 +1,49 @@
from flask import url_for
from app import notifications_api_client
from app.main.utils import BrowsableItem
def insert_service_template(name, type_, content, service_id):
return notifications_api_client.create_service_template(
name, type_, content, service_id)
def update_service_template(id_, name, type_, content, service_id):
return notifications_api_client.update_service_template(
id_, name, type_, content, service_id)
def get_service_templates(service_id):
return notifications_api_client.get_service_templates(service_id)
def get_service_template(service_id, template_id):
return notifications_api_client.get_service_template(
service_id, template_id)
def delete_service_template(service_id, template_id):
return notifications_api_client.delete_service_template(
service_id, template_id)
class TemplatesBrowsableItem(BrowsableItem):
@property
def title(self):
return self._item['name']
@property
def link(self):
return url_for(
'main.edit_service_template',
service_id=self._item['service'],
template_id=self._item['id'])
@property
def destructive(self):
return False
@property
def hint(self):
return "Some service template hint here"