Best Python code snippet using localstack_python
test_firefox_details.py
Source:test_firefox_details.py  
...87class TestFirefoxDesktop(TestCase):88    pd_cache = caches['product-details']89    def setUp(self):90        self.pd_cache.clear()91    def test_get_download_url(self):92        url = firefox_desktop.get_download_url('release', '17.0.1', 'osx', 'pt-BR', True)93        self.assertListEqual(parse_qsl(urlparse(url).query),94                             [('product', 'firefox-latest-ssl'),95                              ('os', 'osx'),96                              ('lang', 'pt-BR')])97        # Windows 64-bit98        url = firefox_desktop.get_download_url('release', '38.0', 'win64', 'en-US', True)99        self.assertListEqual(parse_qsl(urlparse(url).query),100                             [('product', 'firefox-stub'),101                              ('os', 'win64'),102                              ('lang', 'en-US')])103        # Linux 64-bit104        url = firefox_desktop.get_download_url('release', '17.0.1', 'linux64', 'en-US', True)105        self.assertListEqual(parse_qsl(urlparse(url).query),106                             [('product', 'firefox-latest-ssl'),107                              ('os', 'linux64'),108                              ('lang', 'en-US')])109    def test_get_download_url_esr(self):110        """111        The ESR version should give us a bouncer url. There is no stub for ESR.112        """113        url = firefox_desktop.get_download_url('esr', '28.0a2', 'win', 'en-US', True)114        self.assertListEqual(parse_qsl(urlparse(url).query),115                             [('product', 'firefox-esr-latest-ssl'),116                              ('os', 'win'),117                              ('lang', 'en-US')])118        url = firefox_desktop.get_download_url('esr', '28.0a2', 'win64', 'en-US', True)119        self.assertListEqual(parse_qsl(urlparse(url).query),120                             [('product', 'firefox-esr-latest-ssl'),121                              ('os', 'win64'),122                              ('lang', 'en-US')])123        url = firefox_desktop.get_download_url('esr', '28.0a2', 'osx', 'en-US', True)124        self.assertListEqual(parse_qsl(urlparse(url).query),125                             [('product', 'firefox-esr-latest-ssl'),126                              ('os', 'osx'),127                              ('lang', 'en-US')])128        url = firefox_desktop.get_download_url('esr', '28.0a2', 'linux', 'en-US', True)129        self.assertListEqual(parse_qsl(urlparse(url).query),130                             [('product', 'firefox-esr-latest-ssl'),131                              ('os', 'linux'),132                              ('lang', 'en-US')])133        url = firefox_desktop.get_download_url('esr', '28.0a2', 'linux64', 'en-US', True)134        self.assertListEqual(parse_qsl(urlparse(url).query),135                             [('product', 'firefox-esr-latest-ssl'),136                              ('os', 'linux64'),137                              ('lang', 'en-US')])138    def test_get_download_url_esr_next(self):139        """140        The ESR_NEXT version should give us a bouncer url with a full version. There is no stub for ESR.141        """142        url = firefox_desktop.get_download_url('esr_next', '52.4.1esr', 'win', 'en-US', True)143        self.assertListEqual(parse_qsl(urlparse(url).query),144                             [('product', 'firefox-52.4.1esr-SSL'),145                              ('os', 'win'),146                              ('lang', 'en-US')])147        url = firefox_desktop.get_download_url('esr_next', '52.4.1esr', 'win64', 'en-US', True)148        self.assertListEqual(parse_qsl(urlparse(url).query),149                             [('product', 'firefox-52.4.1esr-SSL'),150                              ('os', 'win64'),151                              ('lang', 'en-US')])152        url = firefox_desktop.get_download_url('esr_next', '52.4.1esr', 'osx', 'en-US', True)153        self.assertListEqual(parse_qsl(urlparse(url).query),154                             [('product', 'firefox-52.4.1esr-SSL'),155                              ('os', 'osx'),156                              ('lang', 'en-US')])157        url = firefox_desktop.get_download_url('esr_next', '52.4.1esr', 'linux', 'en-US', True)158        self.assertListEqual(parse_qsl(urlparse(url).query),159                             [('product', 'firefox-52.4.1esr-SSL'),160                              ('os', 'linux'),161                              ('lang', 'en-US')])162        url = firefox_desktop.get_download_url('esr_next', '52.4.1esr', 'linux64', 'en-US', True)163        self.assertListEqual(parse_qsl(urlparse(url).query),164                             [('product', 'firefox-52.4.1esr-SSL'),165                              ('os', 'linux64'),166                              ('lang', 'en-US')])167    def test_get_download_url_winsha1(self):168        # sha1 should get the normal stub installer, bouncer handles the rest169        url = firefox_desktop.get_download_url('release', '56.0', 'winsha1', 'en-US', True)170        self.assertListEqual(parse_qsl(urlparse(url).query),171                             [('product', 'firefox-stub'),172                              ('os', 'win'),173                              ('lang', 'en-US')])174    def test_get_download_url_devedition(self):175        """176        The Developer Edition version should give us a bouncer url. For Windows,177        a stub url should be returned.178        """179        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'win', 'en-US', True)180        self.assertListEqual(parse_qsl(urlparse(url).query),181                             [('product', 'firefox-devedition-stub'),182                              ('os', 'win'),183                              ('lang', 'en-US')])184        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'win64', 'en-US', True)185        self.assertListEqual(parse_qsl(urlparse(url).query),186                             [('product', 'firefox-devedition-stub'),187                              ('os', 'win64'),188                              ('lang', 'en-US')])189        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'osx', 'en-US', True)190        self.assertListEqual(parse_qsl(urlparse(url).query),191                             [('product', 'firefox-devedition-latest-ssl'),192                              ('os', 'osx'),193                              ('lang', 'en-US')])194        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'linux', 'en-US', True)195        self.assertListEqual(parse_qsl(urlparse(url).query),196                             [('product', 'firefox-devedition-latest-ssl'),197                              ('os', 'linux'),198                              ('lang', 'en-US')])199        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'linux64', 'en-US', True)200        self.assertListEqual(parse_qsl(urlparse(url).query),201                             [('product', 'firefox-devedition-latest-ssl'),202                              ('os', 'linux64'),203                              ('lang', 'en-US')])204    def test_get_download_url_devedition_full(self):205        """206        The Developer Edition version should give us a bouncer url. For Windows,207        a full url should be returned.208        """209        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'win', 'en-US', True, True)210        self.assertListEqual(parse_qsl(urlparse(url).query),211                             [('product', 'firefox-devedition-latest-ssl'),212                              ('os', 'win'),213                              ('lang', 'en-US')])214        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'win64', 'en-US', True, True)215        self.assertListEqual(parse_qsl(urlparse(url).query),216                             [('product', 'firefox-devedition-latest-ssl'),217                              ('os', 'win64'),218                              ('lang', 'en-US')])219        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'osx', 'en-US', True, True)220        self.assertListEqual(parse_qsl(urlparse(url).query),221                             [('product', 'firefox-devedition-latest-ssl'),222                              ('os', 'osx'),223                              ('lang', 'en-US')])224        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'linux', 'en-US', True, True)225        self.assertListEqual(parse_qsl(urlparse(url).query),226                             [('product', 'firefox-devedition-latest-ssl'),227                              ('os', 'linux'),228                              ('lang', 'en-US')])229        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'linux64', 'en-US', True, True)230        self.assertListEqual(parse_qsl(urlparse(url).query),231                             [('product', 'firefox-devedition-latest-ssl'),232                              ('os', 'linux64'),233                              ('lang', 'en-US')])234    def test_get_download_url_devedition_l10n(self):235        """236        The Developer Edition version should give us a bouncer url. A stub url237        should be returned for win32/64, while other platforms get a full url.238        The product name is the same as en-US.239        """240        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'win', 'pt-BR', True)241        self.assertListEqual(parse_qsl(urlparse(url).query),242                             [('product', 'firefox-devedition-stub'),243                              ('os', 'win'),244                              ('lang', 'pt-BR')])245        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'win64', 'pt-BR', True)246        self.assertListEqual(parse_qsl(urlparse(url).query),247                             [('product', 'firefox-devedition-stub'),248                              ('os', 'win64'),249                              ('lang', 'pt-BR')])250        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'osx', 'pt-BR', True)251        self.assertListEqual(parse_qsl(urlparse(url).query),252                             [('product', 'firefox-devedition-latest-ssl'),253                              ('os', 'osx'),254                              ('lang', 'pt-BR')])255        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'linux', 'pt-BR', True)256        self.assertListEqual(parse_qsl(urlparse(url).query),257                             [('product', 'firefox-devedition-latest-ssl'),258                              ('os', 'linux'),259                              ('lang', 'pt-BR')])260        url = firefox_desktop.get_download_url('alpha', '28.0a2', 'linux64', 'pt-BR', True)261        self.assertListEqual(parse_qsl(urlparse(url).query),262                             [('product', 'firefox-devedition-latest-ssl'),263                              ('os', 'linux64'),264                              ('lang', 'pt-BR')])265    def test_get_download_url_nightly(self):266        """267        The Nightly version should give us a bouncer url. For Windows, a stub url268        should be returned.269        """270        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'win', 'en-US', True)271        self.assertListEqual(parse_qsl(urlparse(url).query),272                             [('product', 'firefox-nightly-stub'),273                              ('os', 'win'),274                              ('lang', 'en-US')])275        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'win64', 'en-US', True)276        self.assertListEqual(parse_qsl(urlparse(url).query),277                             [('product', 'firefox-nightly-stub'),278                              ('os', 'win64'),279                              ('lang', 'en-US')])280        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'osx', 'en-US', True)281        self.assertListEqual(parse_qsl(urlparse(url).query),282                             [('product', 'firefox-nightly-latest-ssl'),283                              ('os', 'osx'),284                              ('lang', 'en-US')])285        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'linux', 'en-US', True)286        self.assertListEqual(parse_qsl(urlparse(url).query),287                             [('product', 'firefox-nightly-latest-ssl'),288                              ('os', 'linux'),289                              ('lang', 'en-US')])290        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'linux64', 'en-US', True)291        self.assertListEqual(parse_qsl(urlparse(url).query),292                             [('product', 'firefox-nightly-latest-ssl'),293                              ('os', 'linux64'),294                              ('lang', 'en-US')])295    def test_get_download_url_nightly_full(self):296        """297        The Nightly version should give us a bouncer url. For Windows, a full url298        should be returned.299        """300        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'win', 'en-US', True, True)301        self.assertListEqual(parse_qsl(urlparse(url).query),302                             [('product', 'firefox-nightly-latest-ssl'),303                              ('os', 'win'),304                              ('lang', 'en-US')])305        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'win64', 'en-US', True, True)306        self.assertListEqual(parse_qsl(urlparse(url).query),307                             [('product', 'firefox-nightly-latest-ssl'),308                              ('os', 'win64'),309                              ('lang', 'en-US')])310        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'osx', 'en-US', True, True)311        self.assertListEqual(parse_qsl(urlparse(url).query),312                             [('product', 'firefox-nightly-latest-ssl'),313                              ('os', 'osx'),314                              ('lang', 'en-US')])315        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'linux', 'en-US', True, True)316        self.assertListEqual(parse_qsl(urlparse(url).query),317                             [('product', 'firefox-nightly-latest-ssl'),318                              ('os', 'linux'),319                              ('lang', 'en-US')])320        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'linux64', 'en-US', True, True)321        self.assertListEqual(parse_qsl(urlparse(url).query),322                             [('product', 'firefox-nightly-latest-ssl'),323                              ('os', 'linux64'),324                              ('lang', 'en-US')])325    def test_get_download_url_nightly_l10n(self):326        """327        The Nightly version should give us a bouncer url. A stub url should be328        returned for win32/64, while other platforms get a full url. The product329        name is slightly different from en-US.330        """331        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'win', 'pt-BR', True)332        self.assertListEqual(parse_qsl(urlparse(url).query),333                             [('product', 'firefox-nightly-stub'),334                              ('os', 'win'),335                              ('lang', 'pt-BR')])336        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'win64', 'pt-BR', True)337        self.assertListEqual(parse_qsl(urlparse(url).query),338                             [('product', 'firefox-nightly-stub'),339                              ('os', 'win64'),340                              ('lang', 'pt-BR')])341        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'osx', 'pt-BR', True)342        self.assertListEqual(parse_qsl(urlparse(url).query),343                             [('product', 'firefox-nightly-latest-l10n-ssl'),344                              ('os', 'osx'),345                              ('lang', 'pt-BR')])346        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'linux', 'pt-BR', True)347        self.assertListEqual(parse_qsl(urlparse(url).query),348                             [('product', 'firefox-nightly-latest-l10n-ssl'),349                              ('os', 'linux'),350                              ('lang', 'pt-BR')])351        url = firefox_desktop.get_download_url('nightly', '50.0a1', 'linux64', 'pt-BR', True)352        self.assertListEqual(parse_qsl(urlparse(url).query),353                             [('product', 'firefox-nightly-latest-l10n-ssl'),354                              ('os', 'linux64'),355                              ('lang', 'pt-BR')])356    def test_get_download_url_scene2_funnelcake(self):357        scene2 = firefox_desktop.download_base_url_transition358        url = firefox_desktop.get_download_url('release', '45.0', 'win', 'en-US')359        self.assertEqual(url, scene2)360        url = firefox_desktop.get_download_url('release', '45.0', 'win', 'en-US', funnelcake_id='64')361        self.assertEqual(url, scene2 + '&f=64')362    def test_get_download_url_scene2_with_locale(self):363        scene2 = firefox_desktop.download_base_url_transition364        url = firefox_desktop.get_download_url('release', '45.0', 'win', 'de',365                                               locale_in_transition=True)366        self.assertEqual(url, '/de' + scene2)367        url = firefox_desktop.get_download_url('release', '45.0', 'win', 'fr',368                                               locale_in_transition=True,369                                               funnelcake_id='64')370        self.assertEqual(url, '/fr' + scene2 + '&f=64')371    def get_download_url_ssl(self):372        """373        SSL-enabled links should always be used except Windows stub installers.374        """375        # SSL-enabled links won't be used for Windows builds (but SSL download376        # is enabled by default for stub installers)377        url = firefox_desktop.get_download_url('release', '27.0', 'win', 'pt-BR', True)378        self.assertListEqual(parse_qsl(urlparse(url).query),379                             [('product', 'firefox-stub'),380                              ('os', 'win'),381                              ('lang', 'pt-BR')])382        # SSL-enabled links will be used for OS X builds383        url = firefox_desktop.get_download_url('release', '27.0', 'osx', 'pt-BR', True)384        self.assertListEqual(parse_qsl(urlparse(url).query),385                             [('product', 'firefox-latest-ssl'),386                              ('os', 'osx'),387                              ('lang', 'pt-BR')])388        # SSL-enabled links will be used for Linux builds389        url = firefox_desktop.get_download_url('release', '27.0', 'linux', 'pt-BR', True)390        self.assertListEqual(parse_qsl(urlparse(url).query),391                             [('product', 'firefox-latest-ssl'),392                              ('os', 'linux'),393                              ('lang', 'pt-BR')])394    def test_filter_builds_by_locale_name(self):395        # search english396        builds = firefox_desktop.get_filtered_full_builds('release', None,397                                                          'ujara')398        eq_(len(builds), 1)399        eq_(builds[0]['name_en'], 'Gujarati')400        # search native401        builds = firefox_desktop.get_filtered_full_builds('release', None,402                                                          u'àªàª°àª¾')403        eq_(len(builds), 1)404        eq_(builds[0]['name_en'], 'Gujarati')405        # with a space406        builds = firefox_desktop.get_filtered_full_builds('release', None,407                                                          'british english')408        eq_(len(builds), 1)409        eq_(builds[0]['name_en'], 'English (British)')410        # with a comma411        builds = firefox_desktop.get_filtered_full_builds('release', None,412                                                          u'French, Français')413        eq_(len(builds), 1)414        eq_(builds[0]['name_en'], 'French')415    def test_windows64_build(self):416        # Aurora417        builds = firefox_desktop.get_filtered_full_builds('alpha')418        url = builds[0]['platforms']['win64']['download_url']419        eq_(parse_qsl(urlparse(url).query)[1], ('os', 'win64'))420        # Beta421        builds = firefox_desktop.get_filtered_full_builds('beta')422        url = builds[0]['platforms']['win64']['download_url']423        eq_(parse_qsl(urlparse(url).query)[1], ('os', 'win64'))424        # Release425        builds = firefox_desktop.get_filtered_full_builds('release')426        url = builds[0]['platforms']['win64']['download_url']427        eq_(parse_qsl(urlparse(url).query)[1], ('os', 'win64'))428        # ESR429        builds = firefox_desktop.get_filtered_full_builds('esr')430        url = builds[0]['platforms']['win64']['download_url']431        eq_(parse_qsl(urlparse(url).query)[1], ('os', 'win64'))432    def test_linux64_build(self):433        builds = firefox_desktop.get_filtered_full_builds('release')434        url = builds[0]['platforms']['linux64']['download_url']435        eq_(parse_qsl(urlparse(url).query)[1], ('os', 'linux64'))436    @patch.object(firefox_desktop._storage, 'data',437                  Mock(return_value=dict(FIREFOX_ESR='24.2')))438    def test_esr_versions(self):439        """ESR versions should be dynamic based on data."""440        eq_(firefox_desktop.esr_major_versions, [24])441        eq_(firefox_desktop.esr_minor_versions, ['24.2'])442    @patch.object(firefox_desktop._storage, 'data',443                  Mock(return_value=dict(FIREFOX_ESR='24.6.0',444                                         FIREFOX_ESR_NEXT='31.0.0')))445    def test_esr_versions_prev(self):446        """ESR versions should show previous when available."""447        eq_(firefox_desktop.esr_major_versions, [24, 31])448        eq_(firefox_desktop.esr_minor_versions, ['24.6.0', '31.0.0'])449    @patch.object(firefox_desktop._storage, 'data',450                  Mock(return_value=dict(LATEST_FIREFOX_VERSION='Phoenix',451                                         FIREFOX_ESR='Albuquerque')))452    def test_esr_versions_no_latest(self):453        """ESR versions should not blow up if current version is broken."""454        eq_(firefox_desktop.esr_major_versions, [])455        eq_(firefox_desktop.esr_minor_versions, [])456    @patch.object(firefox_desktop._storage, 'data',457                  Mock(return_value=dict(LATEST_FIREFOX_VERSION='18.0.1')))458    def test_latest_major_version(self):459        """latest_major_version should return an int of the major version."""460        eq_(firefox_desktop.latest_major_version('release'), 18)461    @patch.object(firefox_desktop._storage, 'data',462                  Mock(return_value=dict(LATEST_FIREFOX_VERSION='Phoenix')))463    def test_latest_major_version_no_int(self):464        """latest_major_version should return 0 when no int."""465        eq_(firefox_desktop.latest_major_version('release'), 0)466    @patch.dict(os.environ, FUNNELCAKE_64_LOCALES='en-US', FUNNELCAKE_64_PLATFORMS='win')467    def test_funnelcake_direct_links_en_us_win_only(self):468        """469        Ensure funnelcake params are included for Windows en-US builds only.470        """471        url = firefox_desktop.get_download_url('release', '45.0', 'win', 'en-US', force_direct=True, funnelcake_id='64')472        ok_('product=firefox-stub-f64' in url)473        url = firefox_desktop.get_download_url('release', '45.0', 'win64', 'en-US', force_direct=True, funnelcake_id='64')474        ok_('product=firefox-stub-f64' not in url)475        url = firefox_desktop.get_download_url('release', '45.0', 'win', 'de', force_direct=True, funnelcake_id='64')476        ok_('product=firefox-stub-f64' not in url)477        url = firefox_desktop.get_download_url('release', '45.0', 'osx', 'en-US', force_direct=True, funnelcake_id='64')478        ok_('product=firefox-stub-f64' not in url)479    def test_no_funnelcake_direct_links_if_not_configured(self):480        """481        Ensure funnelcake params are included for Linux and OSX en-US builds only.482        """483        url = firefox_desktop.get_download_url('release', '45.0', 'win', 'en-US', force_direct=True, funnelcake_id='64')484        ok_('-f64' not in url)485        url = firefox_desktop.get_download_url('release', '45.0', 'win', 'en-US', force_direct=True, force_full_installer=True, funnelcake_id='64')486        ok_('-f64' not in url)487        url = firefox_desktop.get_download_url('release', '45.0', 'win', 'en-US', force_direct=True, force_funnelcake=True, funnelcake_id='64')488        ok_('-f64' not in url)489        url = firefox_desktop.get_download_url('release', '45.0', 'osx', 'de', force_direct=True, funnelcake_id='64')490        ok_('-f64' not in url)491        url = firefox_desktop.get_download_url('release', '45.0', 'osx', 'en-US', force_direct=True, funnelcake_id='64')492        ok_('-f64' not in url)493        url = firefox_desktop.get_download_url('release', '45.0', 'osx', 'fr', force_direct=True, funnelcake_id='64')494        ok_('-f64' not in url)495        url = firefox_desktop.get_download_url('release', '45.0', 'linux', 'de', force_direct=True, funnelcake_id='64')496        ok_('-f64' not in url)497        url = firefox_desktop.get_download_url('release', '45.0', 'linux', 'en-US', force_direct=True, funnelcake_id='64')498        ok_('-f64' not in url)499        url = firefox_desktop.get_download_url('release', '45.0', 'linux', 'fr', force_direct=True, funnelcake_id='64')500        ok_('-f64' not in url)501    def test_stub_installer_win_only(self):502        """503        Ensure that builds not in the setting don't get stub.504        """505        url = firefox_desktop.get_download_url('release', '19.0', 'osx', 'en-US')506        ok_('product=firefox-stub&' not in url)507        url = firefox_desktop.get_download_url('beta', '20.0b4', 'win', 'fr')508        ok_('product=firefox-beta-stub&' in url)509        url = firefox_desktop.get_download_url('beta', '20.0b4', 'win64', 'fr')510        ok_('product=firefox-beta-stub&' in url)511        url = firefox_desktop.get_download_url('beta', '20.0b4', 'linux', 'fr')512        ok_('product=firefox-beta-stub&' not in url)513class TestFirefoxAndroid(TestCase):514    archive_url_base = 'https://archive.mozilla.org/pub/mobile/nightly/'515    google_play_url_base = ('https://play.google.com/store/apps/details'516                            '?id=org.mozilla.')517    @patch.object(firefox_android._storage, 'data',518                  Mock(return_value=dict(version='22.0.1')))519    def test_latest_release_version(self):520        """latest_version should return the latest release version."""521        eq_(firefox_android.latest_version('release'), '22.0.1')522    @patch.object(firefox_android._storage, 'data',523                  Mock(return_value=dict(beta_version='23.0')))524    def test_latest_beta_version(self):525        """latest_version should return the latest beta version."""526        eq_(firefox_android.latest_version('beta'), '23.0')527    def test_get_download_url_nightly(self):528        """529        get_download_url should return the same Google Play link of the530        'org.mozilla.fennec_aurora' product regardless of the architecture type,531        if the force_direct option is unspecified.532        """533        ok_(firefox_android.get_download_url('nightly', 'arm')534            .startswith(self.google_play_url_base + 'fennec_aurora'))535        ok_(firefox_android.get_download_url('nightly', 'x86')536            .startswith(self.google_play_url_base + 'fennec_aurora'))537    @patch.object(firefox_android._storage, 'data',538                  Mock(return_value=dict(nightly_version='55.0a1')))539    def test_get_download_url_nightly_direct_legacy(self):540        """541        get_download_url should return a mozilla-central archive link depending542        on the architecture type, if the force_direct option is True. The ARM543        build URL should have api-15 instead of api-16.544        """545        eq_(firefox_android.get_download_url('nightly', 'arm', 'multi', True),546            self.archive_url_base + 'latest-mozilla-central-android-api-15/'547            'fennec-55.0a1.multi.android-arm.apk')548        eq_(firefox_android.get_download_url('nightly', 'x86', 'multi', True),549            self.archive_url_base + 'latest-mozilla-central-android-x86/'550            'fennec-55.0a1.multi.android-i386.apk')551    @patch.object(firefox_android._storage, 'data',552                  Mock(return_value=dict(nightly_version='56.0a1')))553    def test_get_download_url_nightly_direct(self):554        """555        get_download_url should return a mozilla-central archive link depending556        on the architecture type, if the force_direct option is True.557        """558        eq_(firefox_android.get_download_url('nightly', 'arm', 'multi', True),559            self.archive_url_base + 'latest-mozilla-central-android-api-16/'560            'fennec-56.0a1.multi.android-arm.apk')561        eq_(firefox_android.get_download_url('nightly', 'x86', 'multi', True),562            self.archive_url_base + 'latest-mozilla-central-android-x86/'563            'fennec-56.0a1.multi.android-i386.apk')564    def test_get_download_url_beta(self):565        """566        get_download_url should return the same Google Play link of the567        'org.mozilla.firefox_beta' product regardless of the architecture type,568        if the force_direct option is unspecified.569        """570        ok_(firefox_android.get_download_url('beta', 'arm')571            .startswith(self.google_play_url_base + 'firefox_beta'))572        ok_(firefox_android.get_download_url('beta', 'x86')573            .startswith(self.google_play_url_base + 'firefox_beta'))574    def test_get_download_url_beta_direct(self):575        """576        get_download_url should return a bouncer link depending on the577        architecture type, if the force_direct option is True.578        """579        url = firefox_android.get_download_url('beta', 'arm', 'multi', True)580        self.assertListEqual(parse_qsl(urlparse(url).query),581                             [('product', 'fennec-beta-latest'),582                              ('os', 'android'), ('lang', 'multi')])583        url = firefox_android.get_download_url('beta', 'x86', 'multi', True)584        self.assertListEqual(parse_qsl(urlparse(url).query),585                             [('product', 'fennec-beta-latest'),586                              ('os', 'android-x86'), ('lang', 'multi')])587    def test_get_download_url_release(self):588        """589        get_download_url should return the same Google Play link of the590        'org.mozilla.firefox' product regardless of the architecture type,591        if the force_direct option is unspecified.592        """593        ok_(firefox_android.get_download_url('release', 'arm')594            .startswith(self.google_play_url_base + 'firefox'))595        ok_(firefox_android.get_download_url('release', 'x86')596            .startswith(self.google_play_url_base + 'firefox'))597    def test_get_download_url_release_direct(self):598        """599        get_download_url should return a bouncer link depending on the600        architecture type, if the force_direct option is True.601        """602        url = firefox_android.get_download_url('release', 'arm', 'multi', True)603        self.assertListEqual(parse_qsl(urlparse(url).query),604                             [('product', 'fennec-latest'),605                              ('os', 'android'), ('lang', 'multi')])606        url = firefox_android.get_download_url('release', 'x86', 'multi', True)607        self.assertListEqual(parse_qsl(urlparse(url).query),608                             [('product', 'fennec-latest'),609                              ('os', 'android-x86'), ('lang', 'multi')])610@patch.object(firefox_ios._storage, 'data',611              Mock(return_value=dict(ios_version='5.0', ios_beta_version='6.0')))612class TestFirefoxIos(TestCase):613    def test_latest_release_version(self):614        """latest_version should return the latest release version."""615        eq_(firefox_ios.latest_version('release'), '5.0')616    def test_latest_beta_version(self):617        """latest_version should return the latest beta version."""...api_server.py
Source:api_server.py  
...9from hunter.videos.tencent_video.decrypt.get_download_url import DownloadURL10app = Flask('video_api_server')11logger = LogManager('video_api_server').file()12@app.route("/video/tencent_video/get_download_url", methods=["POST"])13def get_download_url():14    """15    @api {get} /video/tencent_video/get_download_url è·åè
¾è®¯è§é¢ä¸è½½å°å16    @apiName get_download_url17    @apiVersion 0.0.118    @apiGroup tencent_video api19    @apiParam {String} play_url è§é¢ææ¾å°å20    @apiSuccessExample {json} è¿å示ä¾:21    {22        "code": 10000,23        "data": {24            "play_url": "https://v.qq.com/x/cover/5y07fkhxzj48wcj/g0022cy9bdp.html",25            "download_type": "m3u8",26            "download": [27                {...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
