Esempio n. 1
0
 def setUp(self):
     super(EventListTest, self).setUp()
     service = models.Service(name="Foo", slug="foo", description="Hello")
     service.put()
     status = models.Status(name="Up", slug="up", default=True,
         description="bar", image="cross-circle")
     status.put()
Esempio n. 2
0
 def db_new_service(self, **attrs):
     self.db_lock.acquire()
     try:
         obj = models.Service(**attrs)
         obj.save()
         print 'd2sec_django - Saved service "%s" for host "%s" to database OK' % (attrs['title'], attrs['host'])
     except Exception, e:
         print 'd2sec_django - Failed to save service "%s" for host "%s" : %s' % (attrs['title'], attrs['host'], e)
         obj = None
Esempio n. 3
0
    def test_get_wrong_event(self):
        service = models.Service(name="Bar", slug="bar", description="Hello")
        service.put()

        event = models.Event(service=service, status=self.status, message="foo")
        event.put()

        url = "/admin/api/v1/services/foo/events/%s" % event.key()
        response = self.get(url)
        self.assertEquals(response.status_code, 404)
Esempio n. 4
0
    def setUp(self):
        super(EventInstanceTest, self).setUp()
        service = models.Service(name="Foo", slug="foo", description="Hello")
        service.put()

        self.status = models.Status(name="Up", slug="up", default=True,
            description="bar", image="cross-circle")
        self.status.put()

        self.event = models.Event(service=service, status=self.status,
                message="Foo")
        self.event.put()
Esempio n. 5
0
 def setUp(self):
     super(RSSFeedTest, self).setUp()
     self.services = []
     self.statuses = []
     for name in ['web', 'billing', 'notifications']:
         service = models.Service(name=name.title(),
                                  slug=name,
                                  description="test service")
         service.put()
         self.services.append(service)
     for name in ['up', 'down', 'warning']:
         status = models.Status(name=name.title(),
                                slug=name,
                                description="test status",
                                image="test image")
         status.put()
         self.statuses.append(status)
Esempio n. 6
0
 def setUp(self):
     super(PublicEventsTest, self).setUp()
     service = models.Service(name="Foo", slug="foo", description="Hello")
     service.put()
import glob
import yaml
import models
from jinja2 import Environment, FileSystemLoader, select_autoescape

env = Environment(loader=FileSystemLoader('templates'),
                  autoescape=select_autoescape(['html', 'xml']))

for path in glob.glob('data/services/*/service.yaml'):

    file = open(path, 'rb')
    data = yaml.safe_load(file)

    service = models.Service()
    service.name = data["name"]
    service.description = data["description"]

    service_template = env.get_template('service.html')
    print(service_template.render(service=service))