示例#1
0
 def test_download(self):
     conn = DropboxConnection(email, password)
     conn.download_file("/","small_test_file.txt","small_test_file.txt")
示例#2
0
def upload_file(local_file,remote_dir,remote_file,email,password):
    """ Upload a local file to Dropbox """
    
    conn = DropboxConnection(email, password)
    conn.upload_file(local_file,remote_dir,remote_file)
示例#3
0
 def test_dir_list(self):
     conn = DropboxConnection(email, password)
     conn.get_dir_list("/")
示例#4
0
 def test_upload_small(self):
     conn = DropboxConnection(email, password)
     conn.upload_file("small_test_file.txt","/","small_test_file.txt")
示例#5
0
 def test_bad_login(self):
     try:
         conn = DropboxConnection("bad email", "bad password")
     except:
         self.assertRaises(Exception)
示例#6
0
 def test_login(self):
     conn = DropboxConnection(email, password)
     
     self.assertTrue(conn.is_logged_in())
示例#7
0
########NEW FILE########
__FILENAME__ = example
from dbupload import DropboxConnection
from getpass import getpass

email = raw_input("Enter Dropbox email address:")
password = getpass("Enter Dropbox password:"******"small_test_file.txt","w")
fh.write("Small test file")
fh.close()

try:
    # Create the connection
    conn = DropboxConnection(email, password)
    
    # Upload the file
    conn.upload_file("small_test_file.txt","/","small_test_file.txt")
except:
    print("Upload failed")
else:
    print("Uploaded small_test_file.txt to the root of your Dropbox")
########NEW FILE########
__FILENAME__ = test
from dbupload import upload_file, DropboxConnection
from getpass import getpass
import unittest
import mechanize

# This won't function until these variables are set to valid credentials