Python wrapper for the Mastodon (https://github.com/mastodon/mastodon) API.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Mastodonplus.py/tests
Aljoscha Rittner bd04a0f886 Fixed overseen test failure with new app name in "secret" file 5 months ago
..
cassettes Preserves storage of pagination in items for compatibility reason 6 months ago
cassettes_old_pagination Implement, document and test pagination changes 4 years ago
cassettes_pre_2_9_2 Update tests for 3.0.1 and fix regressions 3 years ago
README.markdown Introduces pagin parameters for bookmarks 6 months ago
__init__.py not pep8 compliant #71 5 years ago
conftest.py Supports a User-Agent header 6 months ago
image.jpg add tests for media 5 years ago
setup.sql Fix tests for 3.1.1 3 years ago
test_account.py Implement, test and document featured and suggested tags APIs (fixes #191) 3 years ago
test_admin.py Add final round of tests for moderation API 4 years ago
test_auth.py Add ability to persist base urls with clientid/secret/token (fixes #200) 3 years ago
test_blurhash.py Add previously forgotten test 4 years ago
test_bookmarks.py Introduces pagin parameters for bookmarks 6 months ago
test_constructor.py New casettes, small fixes 5 years ago
test_create_app.py Fixed overseen test failure with new app name in "secret" file 5 months ago
test_domain_blocks.py add tests for domain block methods 5 years ago
test_errors.py Test fixups pre-2.9.1 4 years ago
test_filters.py Update tests for 3.0.1 and fix regressions 3 years ago
test_follow_requests.py Fresh batch of test runs 4 years ago
test_hooks.py Add another bunch of tests 5 years ago
test_instance.py Add, test and document profile directory API (fixes #188) 3 years ago
test_lists.py New casettes, small fixes 5 years ago
test_markers.py Add, test and document last-read markers. Fixes #192 3 years ago
test_media.py Add push tests 5 years ago
test_notifications.py Update tests for 3.0.1 and fix regressions 3 years ago
test_pagination.py Preserves storage of pagination in items for compatibility reason 6 months ago
test_polls.py Improve own_votes test 3 years ago
test_push.py Update tests for 3.0.1 and fix regressions 3 years ago
test_reports.py Test fixups and small 2.8 fixes 4 years ago
test_search.py Add new parameter for search 3 years ago
test_status.py Improve card test 3 years ago
test_streaming.py Support of processing unknown events and event names with dots. 6 months ago
test_timeline.py Add conversation read marking + tests/docs 4 years ago

README.markdown

Running

To run this test suite, install the testing dependencies:

pip install -e .[test]

Then, run pytest.

If you wish to check test coverage:

pytest --cov=mastodon

And if you want a complete HTML coverage report:

pytest --cov=mastodon --cov-report html:coverage
# then open coverage/index.html in your favourite web browser

Note that some tests are slightly unstable, as they require sidekiq to do things at the right time, and will thus sometimes break.

Contributing

This test suite uses VCR.py to record requests to Mastodon and replay them in successive runs.

If you want to add or change tests, you will need a Mastodon development server running on http://localhost:3000, with the default admin user and default password. To set this up, follow the development guide and set up the database using "rails db:setup".

It also needs a test OAuth app-registriation and an additional test user to be set up by applying the provided setup.sql to Mastodon's database:

psql -d mastodon_development < tests/setup.sql

Tests that send requests to Mastodon should be marked as needing VCR with the pytest.mark.vcr decorator.

import pytest

@pytest.mark.vcr()
def test_fun_new_feature(api):
    foo = api.fun_new_feature()
    assert foo = "bar"