Commit Graph

69 Commits

Author SHA1 Message Date
oakkitten
056e722187 Edit dialog: fix editor buttons on Anki 2.1.50
Also add a few tests for the buttons to make sure
that they get actually added and enabled/disabled.
2022-04-26 15:22:06 +01:00
oakkitten
901d92b067 Tests: make tests pass for Anki 2.1.50 (Qt6)
* Import things from `aqt.qt` not `PyQt5`/`PyQt6`
* When testing with Qt6, disable Anki's Qt5 compatibility mode
* Depend on `pytest-anki` that is also Qt version agnostic
2022-04-26 15:22:06 +01:00
oakkitten
e025a44ea3 Tests: make tests pass for Anki 2.1.50 (Qt5)
* require Python 3.10
* prevent Anki from doing backups, again
* restore cwd that deck exporter changes for some wild reason
2022-04-26 15:22:06 +01:00
oakkitten
6643dca83e Tests: patch waitress to reduce test flakiness
Waitress is a WSGI server that Anki starts to serve css etc to
its web views. It seems to have a race condition issue;
the main loop thread is trying to `select.select` the sockets
which a worker thread is closing because of a dead connection.

This makes waitress skip actually closing the sockets.
2022-04-14 01:55:41 +01:00
oakkitten
c688895c0e Edit dialog: make browser button show all history
Before, pressing the Browse button would only show browser
with the cards or notes corresponding to the currently edited note.

Now, it shows all cards or notes from the dialog history,
in reverse order (last seen on top),
with the currently edited note or its cards selected.
2022-04-14 01:55:41 +01:00
oakkitten
849ab43be7 Tests: simplify profile removal
It turns out that `pytest-anki` does what we are trying to do already.

Note that `empty_anki_session_started` creates a temporary user too.
We are “overwriting“ it in `profile_created_and_loaded`
by calling `temporary_user`. It seems that doing this is safe.
2022-04-11 02:28:25 +01:00
oakkitten
c53aa86a0d Ignore option closeAfterAdding of guiAddCards
The functionality was broken, creating a dialog that was not,
in fact, closing after adding a card.

See the deleted comment in `test_graphical.py`
2022-04-11 02:28:25 +01:00
oakkitten
fb892d330a Add tests for the Edit dialog 2022-04-11 02:28:03 +01:00
oakkitten
8f1a2cc5fd Convert all tests to pytest
Previously, tests were run against Anki launched by user.

Now,
 * most tests run against isolated Anki in current process;
 * tests in `test_server.py` launch another Anki in a separate process
   and run a few commands to test the server;
 * nearly all tests were preserved in the sense that
   what was being tested is tested still.
   A few tests in `test_graphical.py` are skipped due to
   a problem with the method tests, see the comments;
 * tests can be run:
   * In a single profile, using --no-tear-down-profile-after-each-test;
   * In a single app instance, but with the profile being torn down
     after each test--default;
   * In separate processes, using --forked.
2022-04-11 02:26:44 +01:00
penginsan
064fbef413
Add guiSelectedNotes action (#292) 2021-12-06 08:59:10 -08:00
NSBum
8404bd782d
Added guiCheckDatabase action and fix #202 in saveDeckConfig (#271)
* Added guiCheckDatabase action

This action initiates a check database action in Anki but doesn’t wait for the action to complete before returning.

* Fixed #202 no dconf attribute in saveDeckConfig

Anki manages access to deck configuration differently now. This adapts saveDeckConfig to new style of access.
2021-07-13 17:55:22 -07:00
Jason Won
591ac06aa3
allow guiAddCards to add media (#266)
* add media to editing note

* update readme
2021-06-20 20:35:09 -07:00
abdo
f8ff7c0c38
storeMediaFile: Add option to keep file with the same name (#257) 2021-05-22 12:21:12 -07:00
Konstantin Sukovatij
929716c7b1
Added "getMediaFilesNames" action (#247) 2021-04-11 21:26:03 -07:00
Quentin Harscoët
27a8678f88
added getNumCardsReviewedByDay action (#239)
* added getNumCardsReviewedByDay action

* added sample in statistics.md

* fix bad quotes and add basic test
2021-03-06 09:58:40 -08:00
Kirill Salnikov
b8a7151ed0
Fix handling of errors in several methods (#238)
* Fix error message in updateNoteFields method

* Fix error handling in cardsInfo, notesInfo methods

* Add more tests for updateNoteFields, notesInfo

* Fix error handling in several methods

Also fixed obvious bugs in replaceTags and replaceTagsInAllNotes
methods.

* Add more tests for cards methods

* Add more tests for notes methods

* Update documentation on cards methods
2021-03-04 20:06:25 -08:00
Tsung-Po Sun(Munehiro)
a4d723de3e
Add "forgetCards" and "relearnCards" (#234)
* Add "forgetCards" and "relearnCards"

* Add unit tests

Co-authored-by: Tsung-Po Sun <tsungpo.sun@smartnews.com>
2021-03-04 20:02:57 -08:00
Venkata Ramana
131a1c7cfc
Added findAndReplaceInModels (#228)
* added findAndReplaceInModels api call

* added documentation for findAndReplaceInModels

* added findAndReplaceInModels api call

* updatd findAndReplaceInModels function

* added unit test for findAndReplaceInModels in models

* updated findAndReplaceInModels

* added unit test for findAndReplaceInModels

* removed 'all_models' in findAndReplaceInModels
2021-02-26 21:17:51 -08:00
a8273d0e38 Fix tests 2021-01-18 21:03:27 -08:00
Julian Müller
ce0cc7dce3
some additional actions (#185)
* implement needed actions

* add documentation and tests for cardInfo, updateCompleteDeck, reloadCollection, cardReviews, getLatestReviewID, insertReviews

Co-authored-by: Julian Müller <julian.mueller@stud-mail.uni-wuerzburg.de>
2020-07-12 12:53:31 -07:00
Spencer Sharp
84586cb352
Created getEaseFactors and setEaseFactors for Cards, along with documentation and tests for the functions (#181)
Co-authored-by: sherpa <spencersharp1999@gmail.com>
2020-06-10 16:21:58 -07:00
Scott Noyes
80d830caed
Do not strip() during dupe check (#171) 2020-05-08 17:16:05 -07:00
Scott Noyes
faba701251
Collection stats (#166)
* Add endpoint to retrieve collection stats report

* Create separate test for statistics

* Add test for collectionStats

* Fixed typo

* Change endpoint name to use a verb

* Change name to getCollectionStatsHTML
2020-05-03 12:06:43 -07:00
Alex Yatskov
a779fa673f
Merge pull request #159 from snoyes/getProfiles
Add getProfiles action
2020-05-01 12:44:25 -07:00
Scott Noyes
204268b031 Add unit test for importPackage 2020-05-01 13:55:30 -05:00
Scott Noyes
6723332224 Add unit test for getProfiles and loadProfile 2020-05-01 13:38:23 -05:00
0f8b402d73 Update move export to misc, fix return 2020-04-21 18:22:10 -07:00
yakrider
f280a2b8f9 add api to get number of cards reviewed in the current day
partly addresses issue raised in #117
2020-04-19 01:38:03 -04:00
Markus Reil
9ba5c08c96
Support apkg export (#143)
Support apkg export
2020-03-16 22:29:49 -07:00
98566ca8ba Cleanup 2020-01-05 16:24:20 -08:00
24dd22145e Fix tests for Python3 2020-01-05 11:24:13 -08:00
Ben Kogan
be0247ae2f Add get and update endpoints for model templates and styling 2019-10-27 16:55:26 -04:00
Alex Yatskov
5d90bbf1e0
Merge pull request #103 from hgiesel/master
Extend guiAddCards so that it's possible to preset notes
2019-05-03 20:30:27 -07:00
Alex Yatskov
0db93be681
Merge pull request #108 from c-okelly/master
Add new createModel Api end point without documentation
2019-03-01 15:12:55 -08:00
c-okelly
bbcb29ea43 Update changes from PR and add documentation 2019-03-01 17:44:33 +00:00
Mikhail Pontus
47f9db35bd Introduce note deletion functionality 2019-02-26 20:28:36 +03:00
Henrik Giesel
8e6f688e23 Add support for Anki 2.0 2019-01-24 08:36:11 +01:00
bddef5eabd temporarily remove travis until I get it working properly 2018-06-23 10:09:50 -07:00
Charles Henry
5768a28446 Update documentation and unit tests to use version 6 + include new template field in example output of guiCurrentCard 2018-05-25 13:31:32 +01:00
cd11abfc2a fix changeDeck tests 2018-05-09 14:20:20 -07:00
968341a66f add unit tests for cards 2018-05-08 20:38:28 -07:00
95ab8164cd updating note and deck tests 2018-05-08 18:47:45 -07:00
20a39f7604 work on deck tests 2018-05-08 18:29:29 -07:00
4ebcffb698 work on graphical tests 2018-05-08 18:17:26 -07:00
c39e092a04 add graphical tests 2018-05-08 18:16:36 -07:00
d3258e2da4 add media tests 2018-05-08 17:55:45 -07:00
9eabc14b7c add model tests 2018-05-08 17:41:27 -07:00
4c86400d32 cleanup deck tests 2018-05-08 17:22:42 -07:00
a7a03ab1b9 unit test cleanup for misc 2018-05-08 15:18:21 -07:00
ba42cedf1a unit tests for notes 2018-05-08 15:13:49 -07:00