Exemplo n.º 1
0
    def _package(self):
        package = entities.Package(NAME)
        release = entities.Release(VERSION)
        release.add_file(entities.File(FILENAME, None, None))
        package.store_release(release)

        return package
Exemplo n.º 2
0
    def test_generate_simple_html_interface_for_all_packages(self):
        when(self.packages.all).then_return(iter([entities.Package(NAME)]))

        response = self.fetch(ROOT_URL)

        self._assert_that_response_is_valid_for_distutils(response)
        assert_that(response.body, contains_string('<a href="/distutils/viper/" title="viper">viper</a>'))
Exemplo n.º 3
0
    def _deserialize_package(self, result):
        package = entities.Package(result[u'name'])
        self._inject_fields(package, result, exclude=[u'releases'])

        for release in result[u'releases']:
            package.store_release(self._deserialize_release(release))

        return package
Exemplo n.º 4
0
    def get_by_name(self, name, version=None):
        response = self._query_pypi(name, version)

        package = entities.Package(name)
        package.is_from_pypi = True
        release = entities.Release(response['info'][u'version'])

        for key, value in response['info'].iteritems():
            if hasattr(release, key) and value != 'UNKNOWN':
                setattr(release, key, value)

        package.store_release(release)
        return package
Exemplo n.º 5
0
    def _package(self):
        package = entities.Package(NAME)
        package.store_release(entities.Release(VERSION))

        return package
Exemplo n.º 6
0
    def _cached(self):
        package = entities.Package(PACKAGE)
        package.store_release(entities.Release(CACHED_RELEASE))

        return package
Exemplo n.º 7
0
    def _pypi(self):
        package = entities.Package(PACKAGE)
        package.store_release(entities.Release(PYPI_RELEASE))

        return package