Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 894055: Add funnelcake parameter to bedrock URLs.
Now if a page has a download button on it, and the url includes the query param `f=[0..9999]`, then that number will end up on download links in the form `product=firefox-stub-f999`. The ID must be numeric and not exceed 4 digits.
- Loading branch information
Showing
7 changed files
with
119 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
from django.test.client import RequestFactory | ||
|
||
from nose.tools import eq_ | ||
|
||
from bedrock.mozorg.context_processors import funnelcake_param | ||
from bedrock.mozorg.tests import TestCase | ||
|
||
|
||
class TestFunnelcakeParam(TestCase): | ||
def setUp(self): | ||
self.rf = RequestFactory() | ||
|
||
def _funnelcake(self, **kwargs): | ||
return funnelcake_param(self.rf.get('/', kwargs)) | ||
|
||
def test_funnelcake_param_noop(self): | ||
"""Should return an empty dict normally.""" | ||
eq_(self._funnelcake(), {}) | ||
|
||
def test_funnelcake_param_f(self): | ||
"""Should inject funnelcake into context.""" | ||
eq_(self._funnelcake(f='5'), {'funnelcake_id': '5'}) | ||
eq_(self._funnelcake(f='234'), {'funnelcake_id': '234'}) | ||
|
||
def test_funnelcake_param_bad(self): | ||
"""Should not inject bad funnelcake into context.""" | ||
eq_(self._funnelcake(f='5dude'), {}) | ||
eq_(self._funnelcake(f='123456'), {}) |
This file contains 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
This file contains 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
This file contains 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