@@ -33,35 +33,50 @@ def test_toggle_location_services(self):
3333 def test_set_location_float (self ):
3434 driver = android_w3c_driver ()
3535 httpretty .register_uri (httpretty .POST , appium_command ('/session/1234567890/location' ))
36- assert isinstance (driver .set_location (11.1 , 22.2 , 33.3 ), WebDriver )
36+ assert isinstance (driver .set_location (11.1 , 22.2 , 33.3 , 23.2 ), WebDriver )
3737
3838 d = get_httpretty_request_body (httpretty .last_request ())
3939 assert abs (d ['location' ]['latitude' ] - 11.1 ) <= FLT_EPSILON
4040 assert abs (d ['location' ]['longitude' ] - 22.2 ) <= FLT_EPSILON
4141 assert abs (d ['location' ]['altitude' ] - 33.3 ) <= FLT_EPSILON
42+ assert abs (d ['location' ]['speed' ] - 23.2 ) <= FLT_EPSILON
4243
4344 @httpretty .activate
4445 def test_set_location_str (self ):
4546 driver = android_w3c_driver ()
4647 httpretty .register_uri (httpretty .POST , appium_command ('/session/1234567890/location' ))
47- assert isinstance (driver .set_location ('11.1' , '22.2' , '33.3' ), WebDriver )
48+ assert isinstance (driver .set_location ('11.1' , '22.2' , '33.3' , '23.2' ), WebDriver )
4849
4950 d = get_httpretty_request_body (httpretty .last_request ())
5051 assert d ['location' ]['latitude' ] == '11.1'
5152 assert d ['location' ]['longitude' ] == '22.2'
5253 assert d ['location' ]['altitude' ] == '33.3'
54+ assert d ['location' ]['speed' ] == '23.2'
5355
5456 @httpretty .activate
5557 def test_set_location_without_altitude (self ):
5658 driver = android_w3c_driver ()
5759 httpretty .register_uri (httpretty .POST , appium_command ('/session/1234567890/location' ))
58- assert isinstance (driver .set_location (11.1 , 22.2 ), WebDriver )
60+ assert isinstance (driver .set_location (11.1 , 22.2 , speed = 23.2 ), WebDriver )
5961
6062 d = get_httpretty_request_body (httpretty .last_request ())
6163 assert abs (d ['location' ]['latitude' ] - 11.1 ) <= FLT_EPSILON
6264 assert abs (d ['location' ]['longitude' ] - 22.2 ) <= FLT_EPSILON
65+ assert abs (d ['location' ]['speed' ] - 23.2 ) <= FLT_EPSILON
6366 assert d ['location' ].get ('altitude' ) is None
6467
68+ @httpretty .activate
69+ def test_set_location_without_speed (self ):
70+ driver = android_w3c_driver ()
71+ httpretty .register_uri (httpretty .POST , appium_command ('/session/1234567890/location' ))
72+ assert isinstance (driver .set_location (11.1 , 22.2 , 33.3 ), WebDriver )
73+
74+ d = get_httpretty_request_body (httpretty .last_request ())
75+ assert abs (d ['location' ]['latitude' ] - 11.1 ) <= FLT_EPSILON
76+ assert abs (d ['location' ]['longitude' ] - 22.2 ) <= FLT_EPSILON
77+ assert abs (d ['location' ]['altitude' ] - 33.3 ) <= FLT_EPSILON
78+ assert d ['location' ].get ('speed' ) is None
79+
6580 @httpretty .activate
6681 def test_location (self ):
6782 driver = android_w3c_driver ()
0 commit comments