Add more test helpers and integration tests for SyncApp's media sync feature using WebTest's TestApp.

Add test helpers for creating, inspecting and manipulating instances of SyncApp and RestApp.
Add subclasses of Anki's RemoteServer and RemoteMediaServer for communicating with the wrapped SyncApp instance under test.
Add helpers for monkey patching Anki's MediaManager and DB for easier testing.
Add test assets directory.
This commit is contained in:
Christoph Mack
2016-02-29 09:56:28 +01:00
committed by flan
parent cb574aa0a7
commit 573aeece81
8 changed files with 692 additions and 0 deletions

View File

@@ -169,3 +169,19 @@ class FileUtils(object):
zip_file.close()
return file_buffer.getvalue()
def get_asset_path(self, relative_file_path):
"""
Retrieves the path of a file for testing from the "assets" directory.
:param relative_file_path: the name of the file to retrieve, relative
to the "assets" directory
:return: the absolute path to the file in the "assets" directory.
"""
join = os.path.join
script_dir = os.path.dirname(os.path.realpath(__file__))
support_dir = join(script_dir, os.pardir, "assets")
res = join(support_dir, relative_file_path)
return res