Ejemplo n.º 1
0
    def test_get_remote_informations_connection_error(self, mock):
        from papaye.proxy import PyPiProxy
        mock.side_effect = ConnectionError
        url = "http://pypi.python.org/pypi/pyramid/json"

        proxy = PyPiProxy(self.request, 'pyramid')
        result = proxy.get_remote_informations(url)
        self.assertIsNone(result)
Ejemplo n.º 2
0
    def test_get_remote_informations_404(self, mock):
        from papaye.proxy import PyPiProxy
        mock.return_value = FakeGRequestResponse(404, b'')
        url = "http://pypi.python.org/pypi/pyramid/json"

        proxy = PyPiProxy(self.request, 'pyramid')
        result = proxy.get_remote_informations(url)
        self.assertIsNone(result)
Ejemplo n.º 3
0
    def test_get_remote_informations_connection_error(self, mock):
        from papaye.proxy import PyPiProxy
        mock.side_effect = ConnectionError
        url = "http://pypi.python.org/pypi/pyramid/json"

        proxy = PyPiProxy(self.request, 'pyramid')
        result = proxy.get_remote_informations(url)
        self.assertIsNone(result)
Ejemplo n.º 4
0
    def test_get_remote_informations_404(self, mock):
        from papaye.proxy import PyPiProxy
        mock.return_value = FakeGRequestResponse(404, b'')
        url = "http://pypi.python.org/pypi/pyramid/json"

        proxy = PyPiProxy(self.request, 'pyramid')
        result = proxy.get_remote_informations(url)
        self.assertIsNone(result)
Ejemplo n.º 5
0
    def test_get_remote_informations(self, mock):
        from papaye.proxy import PyPiProxy
        mock.return_value = self.pypi_response
        url = "http://pypi.python.org/pypi/pyramid/json"

        proxy = PyPiProxy(self.request, 'pyramid')
        result = proxy.get_remote_informations(url)
        self.assertIsInstance(result, dict)
        self.assertEqual(result['info']['name'], 'pyramid')
Ejemplo n.º 6
0
    def test_get_remote_informations(self, mock):
        from papaye.proxy import PyPiProxy
        mock.return_value = self.pypi_response
        url = "http://pypi.python.org/pypi/pyramid/json"

        proxy = PyPiProxy(self.request, 'pyramid')
        result = proxy.get_remote_informations(url)
        self.assertIsInstance(result, dict)
        self.assertEqual(result['info']['name'], 'pyramid')
Ejemplo n.º 7
0
    def test_get_remote_informations(self, mock):
        # Given
        from papaye.proxy import PyPiProxy
        mock_proxy_response(mock)
        url = "http://pypi.python.org/pypi/pyramid/json"
        proxy = PyPiProxy()

        # When
        result = proxy.get_remote_informations(url)

        # Then
        self.assertIsInstance(result, dict)
        self.assertEqual(result['info']['name'], 'pyramid')