@@ -33,35 +33,50 @@ def test_toggle_location_services(self):
33
33
def test_set_location_float (self ):
34
34
driver = android_w3c_driver ()
35
35
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 )
37
37
38
38
d = get_httpretty_request_body (httpretty .last_request ())
39
39
assert abs (d ['location' ]['latitude' ] - 11.1 ) <= FLT_EPSILON
40
40
assert abs (d ['location' ]['longitude' ] - 22.2 ) <= FLT_EPSILON
41
41
assert abs (d ['location' ]['altitude' ] - 33.3 ) <= FLT_EPSILON
42
+ assert abs (d ['location' ]['speed' ] - 23.2 ) <= FLT_EPSILON
42
43
43
44
@httpretty .activate
44
45
def test_set_location_str (self ):
45
46
driver = android_w3c_driver ()
46
47
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 )
48
49
49
50
d = get_httpretty_request_body (httpretty .last_request ())
50
51
assert d ['location' ]['latitude' ] == '11.1'
51
52
assert d ['location' ]['longitude' ] == '22.2'
52
53
assert d ['location' ]['altitude' ] == '33.3'
54
+ assert d ['location' ]['speed' ] == '23.2'
53
55
54
56
@httpretty .activate
55
57
def test_set_location_without_altitude (self ):
56
58
driver = android_w3c_driver ()
57
59
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 )
59
61
60
62
d = get_httpretty_request_body (httpretty .last_request ())
61
63
assert abs (d ['location' ]['latitude' ] - 11.1 ) <= FLT_EPSILON
62
64
assert abs (d ['location' ]['longitude' ] - 22.2 ) <= FLT_EPSILON
65
+ assert abs (d ['location' ]['speed' ] - 23.2 ) <= FLT_EPSILON
63
66
assert d ['location' ].get ('altitude' ) is None
64
67
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
+
65
80
@httpretty .activate
66
81
def test_location (self ):
67
82
driver = android_w3c_driver ()
0 commit comments