summaryrefslogtreecommitdiff
path: root/isotests
diff options
context:
space:
mode:
Diffstat (limited to 'isotests')
-rw-r--r--isotests/__init__.py0
-rw-r--r--isotests/admin.py10
-rw-r--r--isotests/fixtures/bootloaders.json23
-rw-r--r--isotests/fixtures/filesystems.json23
-rw-r--r--isotests/fixtures/hardware.json44
-rw-r--r--isotests/fixtures/installtype.json30
-rw-r--r--isotests/fixtures/modules.json37
-rw-r--r--isotests/fixtures/source.json23
-rw-r--r--isotests/models.py87
-rw-r--r--isotests/templates/iso_list.html2
-rw-r--r--isotests/tests.py23
-rw-r--r--isotests/urls.py16
-rw-r--r--isotests/views.py24
13 files changed, 342 insertions, 0 deletions
diff --git a/isotests/__init__.py b/isotests/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/isotests/__init__.py
diff --git a/isotests/admin.py b/isotests/admin.py
new file mode 100644
index 00000000..03b5fbab
--- /dev/null
+++ b/isotests/admin.py
@@ -0,0 +1,10 @@
+from isotests.models import *
+from django.contrib import admin
+
+admin.site.register(Iso)
+admin.site.register(Hardware)
+admin.site.register(InstallType)
+admin.site.register(Source)
+admin.site.register(Filesystem)
+admin.site.register(Module)
+admin.site.register(Bootloader)
diff --git a/isotests/fixtures/bootloaders.json b/isotests/fixtures/bootloaders.json
new file mode 100644
index 00000000..545b5c0c
--- /dev/null
+++ b/isotests/fixtures/bootloaders.json
@@ -0,0 +1,23 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.bootloader",
+ "fields": {
+ "name": "grub"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.bootloader",
+ "fields": {
+ "name": "syslinux"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "isotests.bootloader",
+ "fields": {
+ "name": "other/manual"
+ }
+ }
+]
diff --git a/isotests/fixtures/filesystems.json b/isotests/fixtures/filesystems.json
new file mode 100644
index 00000000..4d3f1bc4
--- /dev/null
+++ b/isotests/fixtures/filesystems.json
@@ -0,0 +1,23 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.filesystem",
+ "fields": {
+ "name": "autoprepare (check the installed system, incl fstab)"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.filesystem",
+ "fields": {
+ "name": "manual"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "isotests.filesystem",
+ "fields": {
+ "name": "from config file"
+ }
+ }
+]
diff --git a/isotests/fixtures/hardware.json b/isotests/fixtures/hardware.json
new file mode 100644
index 00000000..c9169146
--- /dev/null
+++ b/isotests/fixtures/hardware.json
@@ -0,0 +1,44 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.hardware",
+ "fields": {
+ "name": "virtualbox"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.hardware",
+ "fields": {
+ "name": "qemu"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "isotests.hardware",
+ "fields": {
+ "name": "intel i686"
+ }
+ },
+ {
+ "pk": 4,
+ "model": "isotests.hardware",
+ "fields": {
+ "name": "intel x86_64"
+ }
+ },
+ {
+ "pk": 5,
+ "model": "isotests.hardware",
+ "fields": {
+ "name": "amd i686"
+ }
+ },
+ {
+ "pk": 6,
+ "model": "isotests.hardware",
+ "fields": {
+ "name": "amd x86_64"
+ }
+ }
+]
diff --git a/isotests/fixtures/installtype.json b/isotests/fixtures/installtype.json
new file mode 100644
index 00000000..d23bd4b2
--- /dev/null
+++ b/isotests/fixtures/installtype.json
@@ -0,0 +1,30 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.installtype",
+ "fields": {
+ "name": "automatic install generic example"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.installtype",
+ "fields": {
+ "name": "automatic install fancy example"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "isotests.installtype",
+ "fields": {
+ "name": "automatic install custom config (specify in comments)"
+ }
+ },
+ {
+ "pk": 4,
+ "model": "isotests.installtype",
+ "fields": {
+ "name": "interactive install"
+ }
+ }
+]
diff --git a/isotests/fixtures/modules.json b/isotests/fixtures/modules.json
new file mode 100644
index 00000000..27d04c7a
--- /dev/null
+++ b/isotests/fixtures/modules.json
@@ -0,0 +1,37 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.module",
+ "fields": {
+ "name": "lvm2"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.module",
+ "fields": {
+ "name": "dm_crypt"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "isotests.module",
+ "fields": {
+ "name": "softraid"
+ }
+ },
+ {
+ "pk": 4,
+ "model": "isotests.module",
+ "fields": {
+ "name": "nilfs2"
+ }
+ },
+ {
+ "pk": 5,
+ "model": "isotests.module",
+ "fields": {
+ "name": "btrfs"
+ }
+ }
+]
diff --git a/isotests/fixtures/source.json b/isotests/fixtures/source.json
new file mode 100644
index 00000000..1bf835a1
--- /dev/null
+++ b/isotests/fixtures/source.json
@@ -0,0 +1,23 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.source",
+ "fields": {
+ "name": "net install manual networking config (Check that it works + rc.conf, resolv.conf, mirrorlist)"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.source",
+ "fields": {
+ "name": "net install dhcp (Check that it works + rc.conf)"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "isotests.source",
+ "fields": {
+ "name": "core"
+ }
+ }
+]
diff --git a/isotests/models.py b/isotests/models.py
new file mode 100644
index 00000000..1eaca163
--- /dev/null
+++ b/isotests/models.py
@@ -0,0 +1,87 @@
+from django.db import models
+
+# Create your models here.
+class Iso(models.Model):
+ date = models.DateField()
+
+ def __unicode__(self):
+ return str(self.date)
+
+class Hardware(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+
+class InstallType(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+
+class Source(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+
+class Filesystem(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+
+class Module(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+
+class Bootloader(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+
+class Test(models.Model):
+ ARCH_CHOICES = (
+ ('d86', 'dual, option i686'),
+ ('d64', 'dual, option x86_64'),
+ ('x86', 'i686'),
+ ('x64', 'x86_64')
+ )
+
+ ISOTYPE_CHOICES = (
+ ('c', 'core'),
+ ('n', 'net')
+ )
+
+ BOOTTYPE_CHOICES = (
+ ('o', 'optical'),
+ ('u', 'usb'),
+ ('p', 'pxe')
+ )
+
+ CLOCK_CHOICES = (
+ ('d', 'default'),
+ ('m', 'configured manually'),
+ ('n', 'NTP')
+ )
+
+ user_name = models.CharField(max_length=500)
+ user_email = models.EmailField()
+ iso = models.ForeignKey(Iso)
+ arch = models.CharField(max_length=3, choices=ARCH_CHOICES)
+ isotype = models.CharField(max_length=1, choices=ISOTYPE_CHOICES)
+ boottype = models.CharField(max_length=1, choices=BOOTTYPE_CHOICES)
+ hardwaretype = models.ForeignKey(Hardware)
+ installtype = models.ForeignKey(InstallType)
+ source = models.ForeignKey(Source)
+ clock = models.CharField(max_length=1, choices=CLOCK_CHOICES)
+ filesystem = models.ForeignKey(Filesystem)
+ ms = models.ManyToManyField(Module)
+ rollback = models.BooleanField()
+ rollback_filesystem = models.ForeignKey(Filesystem, related_name="rollback_test")
+ rollback_modules = models.ManyToManyField(Module, related_name="rollback_test")
+ success = models.BooleanField()
+ comments = models.TextField()
diff --git a/isotests/templates/iso_list.html b/isotests/templates/iso_list.html
new file mode 100644
index 00000000..06572739
--- /dev/null
+++ b/isotests/templates/iso_list.html
@@ -0,0 +1,2 @@
+hello there
+bla
diff --git a/isotests/tests.py b/isotests/tests.py
new file mode 100644
index 00000000..2247054b
--- /dev/null
+++ b/isotests/tests.py
@@ -0,0 +1,23 @@
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+
diff --git a/isotests/urls.py b/isotests/urls.py
new file mode 100644
index 00000000..fdde9e3b
--- /dev/null
+++ b/isotests/urls.py
@@ -0,0 +1,16 @@
+from django.conf.urls.defaults import patterns
+from isotests.models import Test
+
+info_dict = {
+ 'queryset': Test.objects.all()
+}
+
+urlpatterns = patterns('isotests.views',
+ (r'^add/$', 'add_result')
+)
+
+urlpatterns += patterns('',
+ (r'^$', 'django.views.generic.list_detail.object_list', info_dict)
+)
+
+# vim: set ts=4 sw=4 et:
diff --git a/isotests/views.py b/isotests/views.py
new file mode 100644
index 00000000..742be8ff
--- /dev/null
+++ b/isotests/views.py
@@ -0,0 +1,24 @@
+# Create your views here.
+from django.http import HttpResponse, HttpResponseRedirect
+from django.forms import ModelForm
+from isotests.models import Test
+from django.shortcuts import render_to_response
+from django.template import RequestContext
+
+class TestForm(ModelForm):
+ class Meta:
+ model = Test
+
+def add_result(request):
+ if request.method == 'POST': # If the form has been submitted...
+ form = TestForm(request.POST) # A form bound to the post data
+ if form.is_valid(): # All validation rules pass
+ form.save()
+ return HttpResponseRedirect('/isotests') # Redirect after POST
+ else:
+ form = TestForm() # An unbound form
+
+ return render_to_response('isotests/add.html', {
+ 'form': form,
+ },
+ context_instance=RequestContext(request))