[extensions-web] errorreports: Update tests



commit 1973173285c269b088afe155da894c2c03880ecf
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Jun 21 17:44:25 2012 -0400

    errorreports: Update tests

 sweettooth/errorreports/tests.py |   32 ++++++++++++--------------------
 1 files changed, 12 insertions(+), 20 deletions(-)
---
diff --git a/sweettooth/errorreports/tests.py b/sweettooth/errorreports/tests.py
index 9609462..462b196 100644
--- a/sweettooth/errorreports/tests.py
+++ b/sweettooth/errorreports/tests.py
@@ -7,28 +7,20 @@ from django.test import TestCase
 from extensions.models import Extension, ExtensionVersion, STATUS_ACTIVE
 from errorreports import models
 
-class SubmitErrorReportTestCase(TestCase):
-    def setUp(self):
-        super(SubmitErrorReportTestCase, self).setUp()
-        self.username = 'TestUser1'
-        self.email = 'non-existant non-existant tld'
-        self.password = 'a random password'
-        self.user = User.objects.create_user(self.username, self.email, self.password)
-
-        self.client.login(username=self.username, password=self.password)
-
-        self.extension = Extension.objects.create(creator=self.user,
-                                                  name="Testing One",
-                                                  uuid="testing-one aa",
-                                                  description="AAA",
-                                                  url="hey ya")
-        self.version = ExtensionVersion.objects.create(extension=self.extension,
-                                                       source="",
-                                                       status=STATUS_ACTIVE)
-        self.extension.save()
-        self.version.save()
+from testutils import BasicUserTestCase
 
+class SubmitErrorReportTestCase(BasicUserTestCase, TestCase):
     def test_email_sent(self):
+        metadata = {"uuid": "test-metadata mecheye net",
+                    "name": "Test Metadata",
+                    "description": "Simple test metadata",
+                    "url": "http://test-metadata.gnome.org"}
+
+        extension = Extension.objects.create_from_metadata(metadata, creator=self.user)
+        version = ExtensionVersion(extension=extension, status=STATUS_ACTIVE)
+        version.parse_metadata_json(metadata)
+        version.save()
+
         comment = "YOUR EXTENSION SUCKS IT BROKE"
 
         self.client.post(reverse('errorreports.views.report_error',



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]