This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/apps/api/authentication.py b/apps/api/authentication.py | |
index 70f6610..6b8bd6d 100644 | |
--- a/apps/api/authentication.py | |
+++ b/apps/api/authentication.py | |
@@ -1,3 +1,5 @@ | |
+from functools import partial | |
+ | |
import jingo | |
from piston.authentication.oauth import OAuthAuthentication, views | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test_utils/__init__.py b/test_utils/__init__.py | |
index 0e9bf84..dc3fd3e 100644 | |
--- a/test_utils/__init__.py | |
+++ b/test_utils/__init__.py | |
@@ -273,6 +273,7 @@ class TestCase(FastFixtureTestCase): | |
settings.CACHE_COUNT_TIMEOUT = None | |
trans_real.deactivate() | |
trans_real._translations = {} # Django fails to clear this cache. | |
+ trans_real.activate(settings.LANGUAGE_CODE) | |
super(TestCase, self)._pre_setup() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from amo import AMOOAuth | |
amo = AMOOAuth(domain="addons.allizom.org", port=443, protocol='https', | |
prefix='/z') | |
amo.set_consumer(consumer_key='xxxx', | |
consumer_secret='xxx') | |
data = {'addon': 2292, | |
'average': 0.1, | |
'appversion': 1, | |
'osversion': 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from amo import AMOOAuth | |
if 1: | |
amo = AMOOAuth(domain="addons.allizom.org", port=443, protocol='https', | |
prefix='/z') | |
amo.set_consumer(consumer_key='xxx', | |
consumer_secret='xxx') | |
print amo.get_user() | |
~/sandboxes/amo-oauth/src(master) $ python test.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATABASES = { | |
'default': { | |
'NAME': 'zamboni', | |
'ENGINE': 'django.db.backends.mysql', | |
'USER': 'django', | |
'PASSWORD': 'xx', | |
'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'}, | |
'TEST_CHARSET': 'utf8', | |
'TEST_COLLATION': 'utf8_general_ci', | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from amo import AMOOAuth | |
if 1: | |
username = '[email protected]' | |
amo = AMOOAuth(domain="addons.mozilla.local", port=8000, protocol='http', | |
three_legged=False) | |
amo.set_consumer(consumer_key='xx', | |
consumer_secret='xx') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+{% if waffle.switch('marketplace') %} | |
+ <div class="action-needed"> | |
+ <h3>{{ _('Enrolling in Marketplace') }}</h3> | |
+ <p >{% trans doc_url=url('devhub.docs', doc_name='marketplace'), | |
+ payments_url=url('devhub.addons.payments', addon.slug) %} | |
+ If this is a premium add-on you wish to sell in our Marketplace, be sure to enroll | |
+ on the <a href="{{ payments_url }}">Manage Payments</a> page | |
+ <b>before</b> your add-on is reviewed by an editor. <a href="{{ doc_url }}">Learn more</a>. | |
+ {% endtrans %}</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mock.patch.object(waffle, 'switch_is_active', lambda x: True) | |
def test_marketplace(self): | |
addon = Addon.objects.get(pk=3615) | |
#with patch_waffle('switch', lambda x: True): | |
res = self.client.get(reverse('devhub.submit.7', | |
args=[addon.slug])) | |
eq_('If this is a premium add-on' in res.content, True) | |
~/sandboxes/zamboni(679888) $ test apps/devhub/tests/test_views.py:TestSubmitStep7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import jwt | |
>>> key = jwt.rsa_load('/Users/andy/sandboxes/zamboni/apps/files/fixtures/certs/server.key') | |
>>> data = {'foo':'bar'} | |
>>> res = jwt.encode(data, key) | |
>>> jwt.check(res, key) | |
True | |
>>> key2 = jwt.rsa_load('/Users/andy/sandboxes/zamboni/apps/files/fixtures/certs/server.key') | |
>>> jwt.check(res, key2) | |
False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_url_path(self, src): | |
from amo.helpers import urlparams, absolutify | |
- url = os.path.join(reverse('downloads.file', args=[self.id]), | |
- self.filename) | |
+ if self.version.addon.is_premium(): | |
+ url = reverse('downloads.watermarked', args=[self.id]) | |
+ else: | |
+ url = reverse('downloads.file', args=[self.id]) | |
+ url = os.path.join(url, self.filename) | |
# Firefox's Add-on Manager needs absolute urls. |