[extensions-web] extensions: Don't pass back a specific version



commit 34afda7fb7b921620eff9bffd3edb94ad683b703
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Jun 26 18:25:40 2012 -0400

    extensions: Don't pass back a specific version

 sweettooth/extensions/tests.py |   16 +++-------------
 sweettooth/extensions/views.py |   10 +++-------
 2 files changed, 6 insertions(+), 20 deletions(-)
---
diff --git a/sweettooth/extensions/tests.py b/sweettooth/extensions/tests.py
index 215f6b3..050dbbd 100644
--- a/sweettooth/extensions/tests.py
+++ b/sweettooth/extensions/tests.py
@@ -464,16 +464,6 @@ class UpdateVersionTest(TestCase):
     downgrade_uuid = 'downgrade-extension testcases sweettooth mecheye net'
     nonexistant_uuid = "blah-blah-blah testcases sweettooth mecheye net"
 
-    def setUp(self):
-        upgrade_pk = models.Extension.objects.get(uuid=self.upgrade_uuid).latest_version.pk
-        downgrade_pk = models.Extension.objects.get(uuid=self.downgrade_uuid).latest_version.pk
-
-        self.full_expected = { self.upgrade_uuid: dict(operation='upgrade',
-                                                       version_tag=upgrade_pk),
-                               self.reject_uuid: dict(operation='blacklist'),
-                               self.downgrade_uuid: dict(operation='downgrade',
-                                                         version_tag=downgrade_pk) }
-
     def build_response(self, installed):
         return dict((k, dict(version=v)) for k, v in installed.iteritems())
 
@@ -488,7 +478,7 @@ class UpdateVersionTest(TestCase):
         uuid = self.upgrade_uuid
 
         # The user has an old version, upgrade him
-        expected = { uuid: self.full_expected[uuid] }
+        expected = { uuid: 'upgrade' }
         response = self.grab_response({ uuid: 1 })
         self.assertEqual(response, expected)
 
@@ -499,7 +489,7 @@ class UpdateVersionTest(TestCase):
     def test_reject_me(self):
         uuid = self.reject_uuid
 
-        expected = { uuid: self.full_expected[uuid] }
+        expected = { uuid: 'blacklist' }
         response = self.grab_response({ uuid: 1 })
         self.assertEqual(response, expected)
 
@@ -511,7 +501,7 @@ class UpdateVersionTest(TestCase):
         uuid = self.downgrade_uuid
 
         # The user has a rejected version, so downgrade.
-        expected = { uuid: self.full_expected[uuid] }
+        expected = { uuid: 'downgrade' }
         response = self.grab_response({ uuid: 2 })
         self.assertEqual(response, expected)
 
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 7d64691..8f9c52a 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -110,15 +110,11 @@ def shell_update(request):
         proper_version = grab_proper_extension_version(extension, shell_version)
 
         if proper_version is None:
-            operations[uuid] = dict(operation="blacklist")
-
+            operations[uuid] = "blacklist"
         elif version < proper_version.version:
-            operations[uuid] = dict(operation="upgrade",
-                                    version_tag=proper_version.pk)
-
+            operations[uuid] = "upgrade"
         elif version_obj.status == models.STATUS_REJECTED:
-            operations[uuid] = dict(operation="downgrade",
-                                    version_tag=proper_version.pk)
+            operations[uuid] = "downgrade"
 
     return operations
 



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