[extensions-web: 31/75] Update data and tests for real uploading code.
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web: 31/75] Update data and tests for real uploading code.
- Date: Fri, 23 Sep 2011 03:17:02 +0000 (UTC)
commit dbe94e4073e847dcad782d2321b6abaf3e9e02d9
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Sep 14 19:24:59 2011 -0400
Update data and tests for real uploading code.
.../testdata/ExtraMetadata/ExtraMetadata.zip | Bin 289 -> 305 bytes
.../testdata/ExtraMetadata/metadata.json | 1 +
.../testdata/SimpleExtension/SimpleExtension.zip | Bin 270 -> 285 bytes
.../testdata/SimpleExtension/metadata.json | 1 +
sweettooth/extensions/tests.py | 25 ++++++++++++++++++++
5 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/sweettooth/extensions/testdata/ExtraMetadata/ExtraMetadata.zip b/sweettooth/extensions/testdata/ExtraMetadata/ExtraMetadata.zip
index 8c82609..d416ca1 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 c7c2af6..a9a845e 100644
--- a/sweettooth/extensions/testdata/ExtraMetadata/metadata.json
+++ b/sweettooth/extensions/testdata/ExtraMetadata/metadata.json
@@ -1,4 +1,5 @@
{
+ "uuid": "test-extension-2 gnome org",
"name": "Test Extension",
"description": "Fingertips",
"url": "http://extra-metadata.gnome.org",
diff --git a/sweettooth/extensions/testdata/SimpleExtension/SimpleExtension.zip b/sweettooth/extensions/testdata/SimpleExtension/SimpleExtension.zip
index 9bb6c44..9f3a678 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 dd751c6..590a368 100644
--- a/sweettooth/extensions/testdata/SimpleExtension/metadata.json
+++ b/sweettooth/extensions/testdata/SimpleExtension/metadata.json
@@ -1,4 +1,5 @@
{
+ "uuid": "test-extension gnome org",
"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 514f91e..b86765f 100644
--- a/sweettooth/extensions/tests.py
+++ b/sweettooth/extensions/tests.py
@@ -3,6 +3,8 @@ import json
import os.path
from django.test import TestCase
+from django.test.client import Client
+from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from extensions import models
@@ -38,6 +40,28 @@ class UploadTest(TestCase):
metadata = models.parse_zipfile_metadata(f)
version.parse_metadata_json(metadata)
+ self.assertEquals(extension.uuid, "test-extension gnome org")
+ self.assertEquals(extension.name, "Test Extension")
+ self.assertEquals(extension.description, "Simple test metadata")
+ self.assertEquals(extension.url, "http://test-metadata.gnome.org")
+
+ def test_upload_parsing(self):
+ client = Client()
+ client.login(username='testing', password='jjj')
+
+ with get_test_zipfile('SimpleExtension') as f:
+ response = client.post(reverse('extensions-upload-file'),
+ dict(source=f), follow=True)
+
+ extension = models.Extension.objects.get(uuid="test-extension gnome org")
+ version = extension.versions.order_by("-version")[0]
+
+ url = reverse('extensions-version-detail', kwargs=dict(pk=version.pk,
+ ext_pk=extension.pk,
+ slug=extension.slug))
+ self.assertRedirects(response, url)
+
+ self.assertEquals(extension.creator, self.user)
self.assertEquals(extension.name, "Test Extension")
self.assertEquals(extension.description, "Simple test metadata")
self.assertEquals(extension.url, "http://test-metadata.gnome.org")
@@ -52,6 +76,7 @@ class UploadTest(TestCase):
version.parse_metadata_json(metadata)
extra = json.loads(version.extra_json_fields)
+ self.assertEquals(extension.uuid, "test-extension-2 gnome org")
self.assertEquals(extra["extra"], "This is some good data")
self.assertTrue("description" not in extra)
self.assertTrue("url" not in extra)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]