def test_download(self): conn = DropboxConnection(email, password) conn.download_file("/","small_test_file.txt","small_test_file.txt")
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)
def test_dir_list(self): conn = DropboxConnection(email, password) conn.get_dir_list("/")
def test_upload_small(self): conn = DropboxConnection(email, password) conn.upload_file("small_test_file.txt","/","small_test_file.txt")
def test_bad_login(self): try: conn = DropboxConnection("bad email", "bad password") except: self.assertRaises(Exception)
def test_login(self): conn = DropboxConnection(email, password) self.assertTrue(conn.is_logged_in())
########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