Commit Graph

362 Commits

Author SHA1 Message Date
flan
f5050582ba Remove unnecessary class from helpers.server_utils 2017-11-04 00:47:34 +01:00
flan
a48ad44a65 Remove unnecessary class from helpers.file_utils
A class which keeps track of temporary files and removes them
automatically when they're not needed anymore might be a good idea,
but this implementation didn't remove files in some cases. Adding
unrelated methods that could as well be just standalone functions
is bad design, too.

In this case, it's better to just get rid of it altogether instead
of fixing it, since Python 3 has a TemporaryDirectory class, which
can be used for the same purpose and is definitely more
battle-tested.
2017-11-04 00:24:34 +01:00
flan
e959d8745a Place all files in a single directory when testing user managers
Avoids possible filename conflicts.
2017-11-03 02:49:07 +01:00
flan
9451d4df95 Remove redundant Response wraps 2017-11-03 02:18:28 +01:00
flan
5ec0dd7418 Remove redundant json.dumps() calls 2017-11-03 01:49:18 +01:00
flan
2ca7c596e3 Run msync handlers the same way as sync ones 2017-11-03 01:46:38 +01:00
flan
d2bbb7150c Remove unused vars 2017-11-03 01:40:39 +01:00
flan
8e13c92b6e Use less from imports 2017-11-03 00:20:24 +01:00
flan
c1b88c24f9 Make JSON check less lame 2017-11-03 00:19:52 +01:00
flan
910e557776 Rename username2dirname() to userdir() 2017-11-03 00:17:22 +01:00
flan
33868f013d Don't assume a non-SyncCollectionHandler operation is handled by SyncMediaHandler 2017-11-03 00:17:22 +01:00
flan
a52c213088 Make operation_download() and operation_hostKey() return response body
This is more consistent, as all other handlers do the same.
2017-11-03 00:17:16 +01:00
flan
6e84242cc5 Use logging.warn() instead of print() for the auth warning 2017-11-01 19:56:38 +01:00
flan
17331136ca Use print functions everywhere 2017-11-01 19:48:35 +01:00
flan
cb18fcb04a Move old_client() outside classes 2017-11-01 19:48:03 +01:00
flan
a7e29c56f4 Patch anki using git apply 2017-11-01 18:42:43 +01:00
flan
bf02a98a93 Update test_meta() for Anki >=2.0.27 2017-11-01 18:13:35 +01:00
flan
97382f3eb8 Fix check for AnkiDroid 2.3 2017-11-01 18:06:13 +01:00
flan
e1f7c422df Show failing versions when testing _old_client() 2017-11-01 17:45:47 +01:00
flan
85c9b85c1f Make _old_client() support alphas/betas 2017-11-01 17:43:47 +01:00
flan
2dc1f28b04 Move version checks to a separate function, add test 2017-11-01 16:49:07 +01:00
flan
8195e58e3b Make parts of SyncUserSession more readable 2017-11-01 15:36:37 +01:00
flan
bdcbb9eced Note which commit motivated creation of test_login() 2017-11-01 04:35:02 +01:00
flan
6617398921 Don't hardcode location of sqldiff 2017-11-01 04:09:13 +01:00
flan
ce3aa4a685 Make DB utils more general 2017-11-01 04:09:09 +01:00
flan
55bdbfacaa Remove unused lines 2017-10-30 19:56:17 +01:00
flan
39f3ee110d Make test file names follow a single convention
Makes it possible to run all tests by executing
`python -m unittest discover ./tests`.
2017-10-30 19:28:56 +01:00
flan
765cce3d74 Move hostKey handling to a separate function 2017-10-30 19:23:32 +01:00
flan
ce6433b9ba Add functional tests for authentication 2017-10-30 19:19:04 +01:00
flan
3792c89ecb Fix authentication
c7d7ff3e85 broke it
2017-10-29 19:36:51 +01:00
flan
3f3e2f4df4 Fix inconsistent indentation of README code blocks 2017-10-29 04:29:44 +01:00
flan
bf1bf4de72 Add some context from upstream README 2017-10-29 04:21:22 +01:00
flan
6154cfde62 Don't leave an empty directory in cwd after running tests 2017-10-28 23:40:42 +02:00
flan
e464592a57 Add gitignore 2017-10-28 23:18:18 +02:00
Christoph Mack
c805468449 Refactor ankiserverctl.py to delegate database operations to SqliteUserManager and use python3 compatible print calls. 2017-10-28 23:13:46 +02:00
Christoph Mack
c7d7ff3e85 Merge SyncApp's SqliteUserManager and the newly introduced UserManager and group all user managers in user_managers.py. 2017-10-28 22:45:27 +02:00
Christoph Mack
573aeece81 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.
2017-10-28 22:36:48 +02:00
Christoph Mack
cb574aa0a7 Add test helper classes for creating and managing temporary files, working with anki collections and sqlite dbs. Add class for
managing users so users can be added programmatically without using ankiserverctl.
2017-10-28 21:55:19 +02:00
Christoph Mack
28e950c138 Added unit tests for SimpleUserManager, SqliteUserManagerTest, SimpleSessionManager and SqliteSessionManagerTest. 2017-10-28 21:20:47 +02:00
Christoph Mack
6e881bfb85 Added unit test for SyncCollectionHandler. Moved CollectionTestBase to a separate file. 2017-10-28 21:19:50 +02:00
flan
99adc658d5 Remove support for legacy modules 2017-10-28 20:43:24 +02:00
flan
86b63d51b5 Remove superfluous/outdated instructions 2017-10-28 20:40:32 +02:00
Christoph Mack
2cb5871ba3 Safer handling of uploaded database files during full sync.
Before overwriting its version of a user's collection database file with one uploaded by the client, the server now performs a basic integrity check using SQLite's 'pragma integrity_check'.
2017-10-28 20:02:59 +02:00
Christoph Mack
f3788fc2c8 fix syntax error causing failure in error handler in SyncMediaHandler._remove_media_files() 2017-10-28 19:58:34 +02:00
flan
67830218eb Drop support for Anki <2.0.27 2017-10-28 19:55:50 +02:00
flan
b0cb424770 Use os.path.join() for path concatenation 2017-10-28 19:55:50 +02:00
flan
ceb931519d Bring back authentication 2017-10-28 19:55:40 +02:00
flan
48cfa9a029 Remove unused lines 2017-10-28 18:25:23 +02:00
flan
4a9ee4d40c Rewrite command handling 2017-10-28 17:54:58 +02:00
flan
91b5a6e052 Remove redundant messages 2017-10-28 17:50:43 +02:00