[extensions-web/filter-sort-ui: 8/20] Fix the rest of the extension tests



commit 29c548de314625cf48c163d43491ca59d689c39a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Dec 27 15:42:07 2011 -0500

    Fix the rest of the extension tests
    
    We need to stop using @gnome.org for a UUID suffix, it's invalid. We also
    need to make sure that we check the TOS and GPLv2+ checkboxes in the upload
    tests.

 .../testdata/ExtraMetadata/ExtraMetadata.zip       |  Bin 305 -> 310 bytes
 .../testdata/ExtraMetadata/metadata.json           |    2 +-
 .../extensions/testdata/LargeUUID/LargeUUID.zip    |  Bin 296 -> 305 bytes
 .../extensions/testdata/LargeUUID/metadata.json    |    2 +-
 .../testdata/SimpleExtension/SimpleExtension.zip   |  Bin 285 -> 292 bytes
 .../testdata/SimpleExtension/metadata.json         |    2 +-
 sweettooth/extensions/tests.py                     |   34 ++++++++++----------
 7 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/sweettooth/extensions/testdata/ExtraMetadata/ExtraMetadata.zip b/sweettooth/extensions/testdata/ExtraMetadata/ExtraMetadata.zip
index d416ca1..a78e92b 100644
Binary files a/sweettooth/extensions/testdata/ExtraMetadata/ExtraMetadata.zip and b/sweettooth/extensions/testdata/ExtraMetadata/ExtraMetadata.zip differ
diff --git a/sweettooth/extensions/testdata/ExtraMetadata/metadata.json b/sweettooth/extensions/testdata/ExtraMetadata/metadata.json
index a9a845e..3f1f8d6 100644
--- a/sweettooth/extensions/testdata/ExtraMetadata/metadata.json
+++ b/sweettooth/extensions/testdata/ExtraMetadata/metadata.json
@@ -1,5 +1,5 @@
 {
-    "uuid": "test-extension-2 gnome org",
+    "uuid": "test-extension-2 mecheye net",
     "name": "Test Extension",
     "description": "Fingertips",
     "url": "http://extra-metadata.gnome.org";,
diff --git a/sweettooth/extensions/testdata/LargeUUID/LargeUUID.zip b/sweettooth/extensions/testdata/LargeUUID/LargeUUID.zip
index b040e8a..fffb174 100644
Binary files a/sweettooth/extensions/testdata/LargeUUID/LargeUUID.zip and b/sweettooth/extensions/testdata/LargeUUID/LargeUUID.zip differ
diff --git a/sweettooth/extensions/testdata/LargeUUID/metadata.json b/sweettooth/extensions/testdata/LargeUUID/metadata.json
index f3a5c9f..dd204c2 100644
--- a/sweettooth/extensions/testdata/LargeUUID/metadata.json
+++ b/sweettooth/extensions/testdata/LargeUUID/metadata.json
@@ -1,5 +1,5 @@
 {
-    "uuid": "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 gnome org",
+    "uuid": "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 mecheye net",
     "name": "Large UUID test",
     "description": "Simple test metadata",
     "url": "http://test-metadata.gnome.org";
diff --git a/sweettooth/extensions/testdata/SimpleExtension/SimpleExtension.zip b/sweettooth/extensions/testdata/SimpleExtension/SimpleExtension.zip
index 9f3a678..53199c3 100644
Binary files a/sweettooth/extensions/testdata/SimpleExtension/SimpleExtension.zip and b/sweettooth/extensions/testdata/SimpleExtension/SimpleExtension.zip differ
diff --git a/sweettooth/extensions/testdata/SimpleExtension/metadata.json b/sweettooth/extensions/testdata/SimpleExtension/metadata.json
index 590a368..d8f1161 100644
--- a/sweettooth/extensions/testdata/SimpleExtension/metadata.json
+++ b/sweettooth/extensions/testdata/SimpleExtension/metadata.json
@@ -1,5 +1,5 @@
 {
-    "uuid": "test-extension gnome org",
+    "uuid": "test-extension mecheye net",
     "name": "Test Extension",
     "description": "Simple test metadata",
     "url": "http://test-metadata.gnome.org";
diff --git a/sweettooth/extensions/tests.py b/sweettooth/extensions/tests.py
index 3786ac4..8d1c9c3 100644
--- a/sweettooth/extensions/tests.py
+++ b/sweettooth/extensions/tests.py
@@ -55,7 +55,7 @@ class ParseZipfileTest(BasicUserTestCase, TestCase):
             metadata = models.parse_zipfile_metadata(f)
         version.parse_metadata_json(metadata)
 
-        self.assertEquals(extension.uuid, "test-extension gnome org")
+        self.assertEquals(extension.uuid, "test-extension mecheye net")
         self.assertEquals(extension.name, "Test Extension")
         self.assertEquals(extension.description, "Simple test metadata")
         self.assertEquals(extension.url, "http://test-metadata.gnome.org";)
@@ -70,7 +70,7 @@ class ParseZipfileTest(BasicUserTestCase, TestCase):
         version.parse_metadata_json(metadata)
 
         extra = json.loads(version.extra_json_fields)
-        self.assertEquals(extension.uuid, "test-extension-2 gnome org")
+        self.assertEquals(extension.uuid, "test-extension-2 mecheye net")
         self.assertEquals(extra["extra"], "This is some good data")
         self.assertTrue("description" not in extra)
         self.assertTrue("url" not in extra)
@@ -109,12 +109,16 @@ class ReplaceMetadataTest(BasicUserTestCase, TestCase):
         new_zip.close()
 
 class UploadTest(BasicUserTestCase, TestCase):
-    def test_upload_parsing(self):
-        with get_test_zipfile('SimpleExtension') as f:
-            response = self.client.post(reverse('extensions-upload-file'),
-                                        dict(source=f), follow=True)
+    def upload_file(self, zipfile):
+        with get_test_zipfile(zipfile) as f:
+            return self.client.post(reverse('extensions-upload-file'),
+                                    dict(source=f,
+                                         gplv2_compliant=True,
+                                         tos_compliant=True), follow=True)
 
-        extension = models.Extension.objects.get(uuid="test-extension gnome org")
+    def test_upload_parsing(self):
+        response = self.upload_file('SimpleExtension')
+        extension = models.Extension.objects.get(uuid="test-extension mecheye net")
         version1 = extension.versions.order_by("-version")[0]
 
         self.assertEquals(version1.status, models.STATUS_NEW)
@@ -132,9 +136,7 @@ class UploadTest(BasicUserTestCase, TestCase):
         version1.save()
 
         # Try again, hoping to get a new version
-        with get_test_zipfile('SimpleExtension') as f:
-            response = self.client.post(reverse('extensions-upload-file'),
-                                        dict(source=f), follow=True)
+        self.upload_file('SimpleExtension')
 
         version2 = extension.versions.order_by("-version")[0]
         self.assertNotEquals(version1, version2)
@@ -144,11 +146,9 @@ class UploadTest(BasicUserTestCase, TestCase):
 
 
     def test_upload_large_uuid(self):
-        with get_test_zipfile('LargeUUID') as f:
-            response = self.client.post(reverse('extensions-upload-file'),
-                                        dict(source=f), follow=True)
+        self.upload_file('LargeUUID')
 
-        large_uuid = '1234567890'*9 + '@gnome.org'
+        large_uuid = '1234567890'*9 + '@mecheye.net'
         extension = models.Extension.objects.get(uuid=large_uuid)
         version1 = extension.versions.order_by("-version")[0]
 
@@ -162,7 +162,7 @@ class UploadTest(BasicUserTestCase, TestCase):
 class ExtensionVersionTest(BasicUserTestCase, TestCase):
     def test_single_version(self):
         metadata = {"name": "Test Metadata",
-                    "uuid": "test-1 gnome org",
+                    "uuid": "test-1 mecheye net",
                     "description": "Simple test metadata",
                     "url": "http://test-metadata.gnome.org"}
 
@@ -179,7 +179,7 @@ class ExtensionVersionTest(BasicUserTestCase, TestCase):
 
     def test_multiple_versions(self):
         metadata = {"name": "Test Metadata 2",
-                    "uuid": "test-2 gnome org",
+                    "uuid": "test-2 mecheye net",
                     "description": "Simple test metadata",
                     "url": "http://test-metadata.gnome.org"}
 
@@ -204,7 +204,7 @@ class ExtensionVersionTest(BasicUserTestCase, TestCase):
 
     def test_unpublished_version(self):
         metadata = {"name": "Test Metadata 3",
-                    "uuid": "test-3 gnome org",
+                    "uuid": "test-3 mecheye net",
                     "description": "Simple test metadata",
                     "url": "http://test-metadata.gnome.org"}
 



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