diff options
author | maxbr <maxbr@mi.fu-berlin.de> | 2016-08-19 17:11:58 +0200 |
---|---|---|
committer | maxbr <maxbr@mi.fu-berlin.de> | 2016-08-19 17:11:58 +0200 |
commit | a1da09ca6e089913a6aacd5f55051a7f19d6f1fc (patch) | |
tree | 2b2a498a4eb0135bc99d03fe0e2aff2d6fbe8ab1 /pharos-dashboard/booking | |
parent | 79aec84973032e15ae9d36fcbd7d7d42af3283d1 (diff) |
Implement periodic tasks
JIRA: RELENG-12
The dashboard is now querying jenkins periodically and saving the
results in the database. This fixes delays that were caused by calling
the jenkins API.
Signed-off-by: maxbr <maxbr@mi.fu-berlin.de>
Diffstat (limited to 'pharos-dashboard/booking')
-rw-r--r-- | pharos-dashboard/booking/migrations/0001_initial.py | 6 | ||||
-rw-r--r-- | pharos-dashboard/booking/tests/test_models.py | 7 | ||||
-rw-r--r-- | pharos-dashboard/booking/tests/test_views.py | 4 |
3 files changed, 10 insertions, 7 deletions
diff --git a/pharos-dashboard/booking/migrations/0001_initial.py b/pharos-dashboard/booking/migrations/0001_initial.py index 57735ee..9706b81 100644 --- a/pharos-dashboard/booking/migrations/0001_initial.py +++ b/pharos-dashboard/booking/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.10 on 2016-08-12 09:51 +# Generated by Django 1.10 on 2016-08-15 12:19 from __future__ import unicode_literals from django.conf import settings @@ -12,8 +12,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('dashboard', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ @@ -21,10 +21,8 @@ class Migration(migrations.Migration): name='Booking', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), - ('deleted', models.BooleanField(default=False)), ('start', models.DateTimeField()), ('end', models.DateTimeField()), - ('status', models.CharField(max_length=20)), ('purpose', models.CharField(max_length=300)), ('resource', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='dashboard.Resource')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), diff --git a/pharos-dashboard/booking/tests/test_models.py b/pharos-dashboard/booking/tests/test_models.py index e933f6e..00f6b26 100644 --- a/pharos-dashboard/booking/tests/test_models.py +++ b/pharos-dashboard/booking/tests/test_models.py @@ -6,12 +6,15 @@ from django.utils import timezone from booking.models import Booking from dashboard.models import Resource +from jenkins.models import JenkinsSlave class BookingModelTestCase(TestCase): def setUp(self): - self.res1 = Resource.objects.create(name='res1', slavename='s1', description='x', url='x') - self.res2 = Resource.objects.create(name='res2', slavename='s2', description='x', url='x') + self.slave = JenkinsSlave.objects.create(name='test', url='test') + + self.res1 = Resource.objects.create(name='res1', slave=self.slave, description='x', url='x') + self.res2 = Resource.objects.create(name='res2', slave=self.slave, description='x', url='x') self.user1 = User.objects.create(username='user1') diff --git a/pharos-dashboard/booking/tests/test_views.py b/pharos-dashboard/booking/tests/test_views.py index f5b75d1..4f5ee8b 100644 --- a/pharos-dashboard/booking/tests/test_views.py +++ b/pharos-dashboard/booking/tests/test_views.py @@ -12,12 +12,14 @@ from registration.forms import User from account.models import UserProfile from booking.models import Booking from dashboard.models import Resource +from jenkins.models import JenkinsSlave class BookingViewTestCase(TestCase): def setUp(self): self.client = Client() - self.res1 = Resource.objects.create(name='res1', slavename='s1', description='x', url='x') + self.slave = JenkinsSlave.objects.create(name='test', url='test') + self.res1 = Resource.objects.create(name='res1', slave=self.slave, description='x', url='x') self.user1 = User.objects.create(username='user1') self.user1.set_password('user1') self.user1profile = UserProfile.objects.create(user=self.user1) |