Skip to content
This repository
Browse code

Add `hardware` field to gfx blocklist. (bug 824721)

  • Loading branch information...
commit c5ac271ecb1364f5f9c16ad60d63fb011af4b1ba 1 parent 703cecb
washort authored January 07, 2013
1  apps/blocklist/models.py
@@ -133,6 +133,7 @@ class BlocklistGfx(BlocklistBase, amo.models.ModelBase):
133 133
     driver_version = models.CharField(max_length=255, blank=True, null=True)
134 134
     driver_version_comparator = models.CharField(max_length=255, blank=True,
135 135
                                                  null=True)
  136
+    hardware = models.CharField(max_length=255, blank=True, null=True)
136 137
     details = models.OneToOneField(BlocklistDetail, null=True)
137 138
 
138 139
     class Meta:
3  apps/blocklist/templates/blocklist/blocklist.xml
@@ -89,6 +89,9 @@
89 89
       {%- if gfx.driver_version_comparator %}
90 90
       <driverVersionComparator>{{ gfx.driver_version_comparator }}</driverVersionComparator>
91 91
       {%- endif %}
  92
+      {%- if gfx.hardware %}
  93
+      <hardware>{{ gfx.hardware }}</hardware>
  94
+      {%- endif %}
92 95
     </gfxBlacklistEntry>
93 96
   {% endfor %}
94 97
   </gfxItems>
8  apps/blocklist/tests/test_views.py
@@ -452,7 +452,8 @@ def setUp(self):
452 452
         self.gfx = BlocklistGfx.objects.create(
453 453
             guid=amo.FIREFOX.guid, os='os', vendor='vendor', devices='x y z',
454 454
             feature='feature', feature_status='status', details=self.details,
455  
-            driver_version='version', driver_version_comparator='compare')
  455
+            driver_version='version', driver_version_comparator='compare',
  456
+            hardware='giant_robot')
456 457
 
457 458
     def test_no_gfx(self):
458 459
         dom = self.dom(self.mobile_url)
@@ -472,6 +473,7 @@ def test_gfx(self):
472 473
         eq_(find('driverVersion'), self.gfx.driver_version)
473 474
         eq_(find('driverVersionComparator'),
474 475
             self.gfx.driver_version_comparator)
  476
+        eq_(find('hardware'), self.gfx.hardware)
475 477
         devices = gfx.getElementsByTagName('devices')[0]
476 478
         for device, val in zip(devices.getElementsByTagName('device'),
477 479
                                self.gfx.devices.split(' ')):
@@ -486,7 +488,8 @@ def test_empty_devices(self):
486 488
     def test_no_empty_nodes(self):
487 489
         self.gfx.update(os=None, vendor=None, devices=None,
488 490
                         feature=None, feature_status=None,
489  
-                        driver_version=None, driver_version_comparator=None)
  491
+                        driver_version=None, driver_version_comparator=None,
  492
+                        hardware=None)
490 493
         r = self.client.get(self.fx4_url)
491 494
         self.assertNotContains(r, '<os>')
492 495
         self.assertNotContains(r, '<vendor>')
@@ -495,6 +498,7 @@ def test_no_empty_nodes(self):
495 498
         self.assertNotContains(r, '<featureStatus>')
496 499
         self.assertNotContains(r, '<driverVersion>')
497 500
         self.assertNotContains(r, '<driverVersionComparator>')
  501
+        self.assertNotContains(r, '<hardware>')
498 502
 
499 503
     def test_block_id(self):
500 504
         item = (self.dom(self.fx4_url)
1  migrations/516-gfx-blocklist-hardware.sql
... ...
@@ -0,0 +1 @@
  1
+ALTER TABLE blgfxdrivers ADD COLUMN hardware varchar(255) default NULL;

0 notes on commit c5ac271

Please sign in to comment.
Something went wrong with that request. Please try again.