Commit Graph

82 Commits

Author SHA1 Message Date
Vikash Kothary
684b4a2e13 lint: Auto-format code using black 2022-10-14 20:07:21 +01:00
Vikash Kothary
6706a56cc8 test: Fix import collection from anki package
See: #124
2022-03-10 18:08:00 +00:00
samyak-jain
4f62612043 Added unittest 2020-12-17 06:48:31 +05:30
Karsten Lehmann
b0d57d3a02
Use wrapped collection in tests
That way we make sure, our ServerMediaManager is used instead
of the MediaManager
2020-09-02 18:53:24 +02:00
Karsten Lehmann
9831159653
Close whole collection instead of just the database 2020-09-02 18:53:24 +02:00
Karsten Lehmann
60f12cf0a0
file_utils test helper works with new syncer code 2020-09-02 18:53:24 +02:00
Karsten Lehmann
0ef99f3524
mock_servers test helper works with new syncer code 2020-09-02 18:53:24 +02:00
Karsten Lehmann
e2e756dcda
Removed references to unused methods 2020-09-02 18:53:24 +02:00
Karsten Lehmann
5f17eb7db9
server_utils test helper works with non-expose media db 2020-09-02 18:53:24 +02:00
Karsten Lehmann
c5bce6282f
Adapted sync app test to latest changes 2020-09-02 18:53:24 +02:00
Karsten Lehmann
2c1e5936b3
Removed test because of deprecated MediaSyncer 2020-09-02 18:53:24 +02:00
Karsten Lehmann
94da88a3b2
Updated media test to work with latest changes 2020-09-02 18:53:24 +02:00
Karsten Lehmann
9d67943c11
Marked test to fail because of missing _logChanges Method 2020-09-02 18:53:24 +02:00
flan
41205c0b92 Add test for renaming media
This test fails on current master; might or might not be related to #49
2020-02-03 17:20:37 +01:00
flan
3c440621d2 Prevent infinite loop in client when first changed usn != lastUsn
Anki expects the last change in the list to have the server's lastUsn.

Reference: cca3fcb241/anki/sync.py (L720)
2020-01-26 20:47:14 +01:00
flan
e8850f2a5a Migrate old media DB if present 2020-01-04 05:51:33 +01:00
flan
10f47611bf Store media usn per-file
Since anki.media.MediaManager does not store per-file usn (as it's
not really needed for anything in the client), this requires us to
drop it and implement a custom media manager.
2020-01-04 05:51:33 +01:00
flan
c4730b1596 Add test for #44 2020-01-04 05:51:33 +01:00
Anton Melser
fa89b0e0a2 Load the CollectionWrapper from a factory method
This allows a class implementing CollectionWrapper's interface to be
added from config
2019-03-09 14:05:15 +08:00
Anton Melser
9ee9697582 Move the upload/download sqlite3 file logic to a manager
Also add a factory method so the manager can be controlled via config
2019-03-09 14:05:15 +08:00
Anton Melser
50cc6a12d9 Use factory method for session_manager
Also add some abstraction over the SQL to allow for different SQL
dialects
2019-03-09 14:05:15 +08:00
Anton Melser
ea0cbc669b Use factory method for user_manager
Also add some abstraction over the SQL to allow for different SQL
dialects
2019-03-09 14:05:12 +08:00
flan
970664e6a9 Revert "Simplify version suffix patch"
95ccbfdd36 broke it

This reverts commit 61b4582364.
2019-02-19 00:52:43 +01:00
flan
e892c0a22c Add test case for ankidesktop 2.1.6-beta2 2018-12-13 00:33:06 +01:00
flan
6a073635ac Update unit tests 2018-12-13 00:33:02 +01:00
flan
59f28faa1e Use mapping protocol access instead of legacy configparser API 2017-11-06 21:06:18 +01:00
flan
0e5bbf4f9e Use more with statements 2017-11-04 18:41:56 +01:00
flan
1677ed38b9 Update comment 2017-11-04 17:39:37 +01:00
flan
af8548182b Shorten MockServerConnection.post() 2017-11-04 17:38:29 +01:00
flan
024e76423d Explicitly convert str and bytes where needed 2017-11-04 04:11:48 +01:00
flan
5aff76fee7 Update mock server 2017-11-04 03:35:55 +01:00
flan
3d6a2a639a Remove explicit inherits from object 2017-11-04 02:53:52 +01:00
flan
32b82d5803 Fix up some changes made by 2to3 2017-11-04 02:53:49 +01:00
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