diff --git a/dropbox/dropbox.py b/dropbox/dropbox.py index 002300d6..3233b1a8 100644 --- a/dropbox/dropbox.py +++ b/dropbox/dropbox.py @@ -249,6 +249,8 @@ def request(self, """ host = route.attrs['host'] or 'api' route_name = namespace + '/' + route.name + if route.version > 1: + route_name += '_v{}'.format(route.version) route_style = route.attrs['style'] or 'rpc' serialized_arg = stone_serializers.json_encode(route.arg_type, request_arg) diff --git a/test/test_dropbox.py b/test/test_dropbox.py index 9a409463..7060ffb7 100644 --- a/test/test_dropbox.py +++ b/test/test_dropbox.py @@ -32,6 +32,7 @@ PathRootError, ) from dropbox.files import ( + DeleteResult, ListFolderError, ) from dropbox.common import ( @@ -191,6 +192,17 @@ def test_path_root_err(self, dbx): dbxpr.files_list_folder('') self.assertTrue(cm.exception.error.is_invalid_root()) + @dbx_from_env + def test_versioned_route(self, dbx): + # Upload a test file + path = '/test.txt' + dbx.files_upload(DUMMY_PAYLOAD, path) + + # Delete the file with v2 route + resp = dbx.files_delete_v2(path) + # Verify response type is of v2 route + self.assertIsInstance(resp, DeleteResult) + class TestDropboxTeam(unittest.TestCase): @dbx_team_from_env def test_team(self, dbxt):