Permalink
Browse files

Added CORS tests for @mattbasta's commit 6d51aa2

  • Loading branch information...
1 parent 6d51aa2 commit 375d896c58d1f7aa7f2723d45e987df10e11b176 @robhudson robhudson committed Apr 10, 2013
Showing with 10 additions and 0 deletions.
  1. +10 −0 mkt/ratings/tests/test_resources.py
@@ -28,6 +28,11 @@ def _collection_url(self, **kwargs):
data.update(kwargs)
return ('api_dispatch_list', {'resource_name': 'rating'}, data)
+ def test_has_cors(self):
@cvan

cvan Apr 10, 2013

Member

do we have a CORSResourceTest mixin? that would be hella useful

@robhudson

robhudson Apr 10, 2013

Member

it would be, except the methods often change and so do the urls b/c they're not named consistently.

+ res = self.client.get(self._collection_url())
+ eq_(res['Access-Control-Allow-Origin'], '*')
+ eq_(res['Access-Control-Allow-Methods'], 'GET, POST, OPTIONS')
+
def test_get(self):
AddonUser.objects.create(user=self.user, addon=self.app)
res = self.client.get(self._collection_url())
@@ -239,6 +244,11 @@ def setUp(self):
{'resource_name': 'rating',
'review_id': self.rating.pk}, {})
+ def test_has_cors(self):
+ res = self.client.get(self.flag_url)
+ eq_(res['Access-Control-Allow-Origin'], '*')
+ eq_(res['Access-Control-Allow-Methods'], 'GET, OPTIONS')
+
def test_flag(self):
data = json.dumps({'flag': ReviewFlag.SPAM})
res = self.client.post(self.flag_url, data=data)

0 comments on commit 375d896

Please sign in to comment.