def test_fallback_packages(self):
        """ Fetch fallback packages """
        self.request.locator = MagicMock()
        version = '1.1'
        name = 'foo'
        filename = '%s-%s.tar.gz' % (name, version)
        url = 'http://pypi.python.org/pypi/%s/%s' % (name, filename)
        wheelname = '%s-%s.whl' % (name, version)
        wheel_url = 'http://pypi.python.org/pypi/%s/%s' % (name, wheelname)
        dist = MagicMock()
        dist.name = name
        self.request.locator.get_project.return_value = {
            version: dist,
            'urls': {
                version: [url, wheel_url]
            }
        }
        self.request.app_url = MagicMock()
        pkgs = get_fallback_packages(self.request, 'foo', False)
        self.request.app_url.assert_any_call('api', 'package', name, filename)
        self.request.app_url.assert_any_call('api', 'package', name, wheelname)
        self.assertEqual(pkgs, {
            filename: self.request.app_url(),
            wheelname: self.request.app_url(),
        })
dataset/ETHPy150Open mathcamp/pypicloud/tests/test_simple.py/TestSimple.test_fallback_packages/original