forked from xybu/onedrived-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] Unit tests and code refactoring.
Signed-off-by: Xiangyu Bu <[email protected]>
- Loading branch information
Showing
10 changed files
with
187 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"value":[ | ||
{ | ||
"quota":{ | ||
"remaining":29772095467, | ||
"used":5661384725, | ||
"total":35433480192, | ||
"state":"normal", | ||
"deleted":716108357, | ||
"storagePlans":{ | ||
"upgradeAvailable":true | ||
} | ||
}, | ||
"status":{ | ||
"state":"active" | ||
}, | ||
"owner":{ | ||
"user":{ | ||
"displayName":"Xiangyu Bu", | ||
"id":"d781730a6d2c6611" | ||
} | ||
}, | ||
"id":"xb_drive_id", | ||
"driveType":"personal" | ||
}, | ||
{ | ||
"id":"xybu_id", | ||
"driveType":"personal", | ||
"owner":{ | ||
"user":{ | ||
"id":"713d61", | ||
"displayName":"Ryan Gregg" | ||
} | ||
}, | ||
"status":{ | ||
"state":"active" | ||
}, | ||
"quota":{ | ||
"total":1024000, | ||
"used":514000, | ||
"remaining":1010112, | ||
"deleted":0, | ||
"state":"normal" | ||
} | ||
}, | ||
{ | ||
"id":"0123456789abc", | ||
"owner":{ | ||
"user":{ | ||
"id":"713d61", | ||
"displayName":"Ryan Gregg" | ||
} | ||
}, | ||
"quota":{ | ||
"total":10240000, | ||
"used":514133, | ||
"remaining":1010112, | ||
"deleted":0, | ||
"state":"normal" | ||
}, | ||
"status":{ | ||
"state":"active" | ||
}, | ||
"driveType":"personal" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import tempfile | ||
import unittest | ||
|
||
import click | ||
|
||
from onedrived import od_main | ||
|
||
|
||
class TestMainCLI(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.tempdir = tempfile.TemporaryDirectory() | ||
click.get_app_dir = lambda x: self.tempdir.name + '/' + x | ||
od_main.context = od_main.load_context() | ||
od_main.context._create_config_dir_if_missing() | ||
|
||
def tearDown(self): | ||
self.tempdir.cleanup() | ||
|
||
def test_init_and_shutdown_task_workers(self): | ||
od_main.init_task_pool_and_workers() | ||
od_main.shutdown_workers() | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters