Пример #1
0
    def test_versioned_url_for_regular_assets(self):
        self._setting_overrides.update({
            'EQ_MINIMIZE_ASSETS': False,
            'EQ_APPLICATION_VERSION': False,
        })
        application = create_app(self._setting_overrides)
        application.config['SERVER_NAME'] = 'test'

        with application.app_context(), self.override_settings():
            self.assertEqual('http://test/s/some.css?q=False',
                             versioned_url_for('static', filename='some.css'))

            self.assertEqual('http://test/s/some.js?q=False',
                             versioned_url_for('static', filename='some.js'))
Пример #2
0
    def test_versioned_url_for_with_version(self):
        self._setting_overrides['EQ_APPLICATION_VERSION'] = 'abc123'
        application = create_app(self._setting_overrides)
        application.config['SERVER_NAME'] = 'test'

        with application.app_context(), self.override_settings():
            self.assertEqual('http://test/s/a.jpg?q=abc123',
                             versioned_url_for('static', filename='a.jpg'))
Пример #3
0
    def test_versioned_url_for_without_version(self):
        self._setting_overrides.update({
            'EQ_APPLICATION_VERSION': False,
        })
        application = create_app(self._setting_overrides)
        application.config['SERVER_NAME'] = 'test'

        # Patches the application version, since it's used in `versioned_url_for`
        with application.app_context(), self.override_settings():
            self.assertEqual('http://test/s/a.jpg?q=False',
                             versioned_url_for('static', filename='a.jpg'))