Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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')
Пример #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')
Пример #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')