13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
15
16
- import base64
17
16
import unittest
18
- from zipfile import ZipFile
19
17
import os
20
- import random
21
18
from time import sleep
22
19
from dateutil .parser import parse
23
20
@@ -42,10 +39,6 @@ def setUp(self):
42
39
def tearDown (self ):
43
40
self .driver .quit ()
44
41
45
- # remove zipped file from `test_pull_folder`
46
- if hasattr (self , 'zipfilename' ) and os .path .isfile (self .zipfilename ):
47
- os .remove (self .zipfilename )
48
-
49
42
def test_screen_record (self ):
50
43
self .driver .start_recording_screen (timeLimit = 10 , forcedRestart = True )
51
44
sleep (10 )
@@ -99,35 +92,6 @@ def test_current_package(self):
99
92
package = self .driver .current_package
100
93
self .assertEqual ('com.example.android.apis' , package )
101
94
102
- def test_push_pull_file (self ):
103
- path = '/data/local/tmp/test_push_file.txt'
104
- data = b'This is the contents of the file to push to the device.'
105
-
106
- self .driver .push_file (path , base64 .b64encode (data ).decode ('utf-8' ))
107
- data_ret = base64 .b64decode (self .driver .pull_file (path ))
108
-
109
- self .assertEqual (data , data_ret )
110
-
111
- def test_pull_folder (self ):
112
- string_data = b'random string data %d' % random .randint (0 , 1000 )
113
- path = '/data/local/tmp'
114
-
115
- self .driver .push_file (path + '/1.txt' , base64 .b64encode (string_data ).decode ('utf-8' ))
116
- self .driver .push_file (path + '/2.txt' , base64 .b64encode (string_data ).decode ('utf-8' ))
117
-
118
- folder = self .driver .pull_folder (path )
119
-
120
- # python doesn't have any functionality for unzipping streams
121
- # save temporary file, which will be deleted in `tearDown`
122
- self .zipfilename = 'folder_%d.zip' % random .randint (0 , 1000000 )
123
- with open (self .zipfilename , "wb" ) as fw :
124
- fw .write (base64 .b64decode (folder ))
125
-
126
- with ZipFile (self .zipfilename , 'r' ) as myzip :
127
- # should find these. otherwise it will raise a `KeyError`
128
- myzip .read ('1.txt' )
129
- myzip .read ('2.txt' )
130
-
131
95
def test_background_app (self ):
132
96
self .driver .background_app (1 )
133
97
sleep (3 )
@@ -257,6 +221,6 @@ def test_device_time(self):
257
221
parse (date_time )
258
222
259
223
260
- if __name__ == " __main__" :
224
+ if __name__ == ' __main__' :
261
225
suite = unittest .TestLoader ().loadTestsFromTestCase (AppiumTests )
262
226
unittest .TextTestRunner (verbosity = 2 ).run (suite )
0 commit comments