Commit Graph

49 Commits

Author SHA1 Message Date
flan
0cc21101d7 2to3 everything 2017-11-04 02:06:42 +01:00
flan
d4f7c87fb4 Remove debug prints 2017-11-04 01:44:49 +01:00
flan
ec83527fa4 Remove unused function 2017-11-04 01:41:45 +01:00
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
910e557776 Rename username2dirname() to userdir() 2017-11-03 00:17:22 +01:00
flan
cb18fcb04a Move old_client() outside classes 2017-11-01 19:48:03 +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
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
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
6154cfde62 Don't leave an empty directory in cwd after running tests 2017-10-28 23:40:42 +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
jdoe0
d573bf6b42 Remove things not needed by sync_app 2013-08-14 18:47:47 +07:00
David Snopek
294afba2ac Added a quick way to get a list of all collections. 2013-07-31 18:17:58 +01:00
David Snopek
d6c1ae164c Implemented a way to re-import from an .apkg file and update the existing notes. 2013-07-30 17:10:49 +01:00
David Snopek
442037c211 Implemented 'cards_recent_ease' to pull a list of the most recent answers to a list of cards. 2013-07-27 13:41:20 +01:00
David Snopek
0798415076 * Fixed bug in 'find_cards'.
* Seperated CSS and HTML on the cards.
2013-07-26 14:09:25 +01:00
David Snopek
3fe1e0eb06 Implemented 'create_dynamic_deck' for custom study options. 2013-07-24 20:17:52 +01:00
David Snopek
46dab1c612 Added 'list_tags'. 2013-07-24 19:28:24 +01:00
David Snopek
1348950875 Attempt to allow the user to configure the scheduler. 2013-07-24 17:06:08 +01:00
David Snopek
e582d8284b * Added the ability to suspend/unsuspend cards.
* Added the ability to add/remove tags.
2013-07-23 00:33:53 +01:00
David Snopek
28ad457773 Began testing and fleshing out the NoteHandler. 2013-07-22 23:48:06 +01:00
David Snopek
0b7628f5e4 Began fleshing out the CardHandler. 2013-07-22 23:35:03 +01:00
David Snopek
34cb8fe09b Did some refactoring moving the 'next_card' stuff into the CollectionHandler. 2013-07-22 22:37:34 +01:00
David Snopek
ffde4a7ff6 * Added sessions and refactored the handler arguments to only take the collection and (new) request object
* Got 'answer_card' actually working

 * Added some support for the translation built into Anki
2013-07-22 20:11:53 +01:00
David Snopek
45efa650d5 Refactor adding our default note for testing. 2013-07-17 17:47:53 +01:00
David Snopek
4e8f1d217e Forgot to test the answer buttons too! 2013-07-17 17:37:11 +01:00
David Snopek
59f8171798 Serialize more of the card object. 2013-07-17 17:34:34 +01:00
David Snopek
d925cddf17 Implemented import support! 2013-07-16 16:58:04 +01:00
David Snopek
022235ec60 * Simplified the *HandlerGroup to *Handler.
* Added lots of operations connected with models and notes.
2013-07-16 15:12:05 +01:00
David Snopek
93094ebb48 * Added new handler type 'card' and moved the position of 'note'
* Got us actually adding notes and cards to the Anki collection!
2013-07-16 14:20:31 +01:00
David Snopek
a31de8a91a Got almost 80% test coverage of AnkiServer/apps/rest_app.py and fixed some bugs. 2013-07-15 17:11:28 +01:00
David Snopek
57d3ba5445 Refactored AnkiServer/apps/rest_app.py so that it is actually testable. 2013-07-15 16:13:48 +01:00
David Snopek
f707c8409c Got nearly 100% test coverage for AnkiServer/collection.py 2013-07-15 15:27:13 +01:00
David Snopek
e25cf25684 Squashed commit of the following:
commit cb509e8f75e3dcdbc66327be4bfbf6661aa084b5
Author: David Snopek <dsnopek@gmail.com>
Date:   Fri Jul 12 22:06:28 2013 +0100

    Cut down 'import' statements to only modules actually used.

commit 0ea255115e095e31af5a991e9cce2b5b15cb496d
Author: David Snopek <dsnopek@gmail.com>
Date:   Fri Jul 12 22:00:06 2013 +0100

     * Add getCollectionManager() so that the whole process can share the same ThreadingCollectionManager object.

     * Got the RestApp actually working!

commit 00997bab600b13d4b430ed2c2839b1d2232f55ed
Author: David Snopek <dsnopek@gmail.com>
Date:   Fri Jul 12 21:04:58 2013 +0100

    Got the sync_app working again (more or less)

commit 459c69566bb92d2c0195a384e067d98c059bdea7
Author: David Snopek <dsnopek@gmail.com>
Date:   Fri Jul 12 19:47:40 2013 +0100

    Started implementing test for the RESTful callbacks that PrepECN is going to need.

commit 7ffbac793f9bf45ab9056c1de475422b8742e107
Author: David Snopek <dsnopek@gmail.com>
Date:   Fri Jul 12 17:19:06 2013 +0100

    Started work on a WSGI app for RESTful access to Anki based on Bibliobird code here:

      https://raw.github.com/dsnopek/bbcom/master/AnkiServer/AnkiServer/deck.py

commit 8820411388ce0c2b7b14769c614c22c675d2dbdd
Author: David Snopek <dsnopek@gmail.com>
Date:   Fri Jul 12 15:03:56 2013 +0100

     * Seperated the collection and threading code.

     * Implemented a new interface to interact with the collections, which will hopefully be more transparent and testable.
2013-07-12 22:08:16 +01:00