@@ -26,6 +26,17 @@ def test_should_reset_client_with_new_app_identifier(self):
2626 tinify .get_client ().request ('GET' , '/' )
2727 self .assertEqual (self .request .headers ['user-agent' ], tinify .Client .USER_AGENT + " MyApp/2.0" )
2828
29+ class TinifyProxy (TestHelper ):
30+ def test_should_reset_client_with_new_proxy (self ):
31+ httpretty .register_uri (httpretty .CONNECT , 'http://localhost:8080' )
32+ tinify .key = 'abcde'
33+ tinify .proxy = 'http://localhost:8080'
34+ tinify .get_client ()
35+ tinify .proxy = 'http://localhost:8080'
36+ raise SkipTest ('https://github.com/gabrielfalcao/HTTPretty/issues/122' )
37+ tinify .get_client ().request ('GET' , '/' )
38+ self .assertEqual (self .request .headers ['user-agent' ], tinify .Client .USER_AGENT + " MyApp/2.0" )
39+
2940class TinifyClient (TestHelper ):
3041 def test_with_key_should_return_client (self ):
3142 tinify .key = 'abcde'
@@ -35,6 +46,12 @@ def test_without_key_should_raise_error(self):
3546 with self .assertRaises (tinify .AccountError ):
3647 tinify .get_client ()
3748
49+ def test_with_invalid_proxy_should_raise_error (self ):
50+ with self .assertRaises (tinify .ConnectionError ):
51+ tinify .key = 'abcde'
52+ tinify .proxy = 'http-bad-url'
53+ tinify .get_client ().request ('GET' , '/' )
54+
3855class TinifyValidate (TestHelper ):
3956 def test_with_valid_key_should_return_true (self ):
4057 httpretty .register_uri (httpretty .POST , 'https://api.tinify.com/shrink' , status = 400 ,
0 commit comments