146 lines
5.3 KiB
Plaintext
146 lines
5.3 KiB
Plaintext
# SOME DESCRIPTIVE TITLE.
|
||
# Copyright (C) 2023, The Funkwhale Collective
|
||
# This file is distributed under the same license as the funkwhale package.
|
||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||
#
|
||
#, fuzzy
|
||
msgid ""
|
||
msgstr ""
|
||
"Project-Id-Version: funkwhale 1.2.10\n"
|
||
"Report-Msgid-Bugs-To: \n"
|
||
"POT-Creation-Date: 2023-03-24 18:14+0100\n"
|
||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||
"MIME-Version: 1.0\n"
|
||
"Content-Type: text/plain; charset=UTF-8\n"
|
||
"Content-Transfer-Encoding: 8bit\n"
|
||
|
||
#: ../../developer/contribute/api.md:1
|
||
msgid "Contribute to the API"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:3
|
||
msgid "The Funkwhale API is the core of the Funkwhale ecosystem. It powers all actions in the Funkwhale app as well as other apps such as the CLI and mopidy plugin. The API is written in [Django rest framework](https://www.django-rest-framework.org/)."
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:5
|
||
msgid "Before you start work on the API, you should open up a conversation in [the forum](https://forum.funkwhale.audio) to discuss the changes you want to make. All API changes need to be defined and scoped before code changes are made. If you are fixing a bug, you don't need to discuss this in the forum first."
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:7
|
||
msgid "Each API endpoint is made up of the following:"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:9
|
||
msgid "Model – defines the shape of data and how it is stored in the database"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:10
|
||
msgid "View – defines what data is reflected by an endpoint"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:11
|
||
msgid "Serializer – defines how data is serialized and deserialized by the endpoint"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:13
|
||
msgid "The API directory is structured as follows:"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:15
|
||
msgid "`config` – contains the project settings, URL structure, and web server gateway information setup"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:16
|
||
msgid "`settings` – contains all Django settings files"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:17
|
||
msgid "`funkwhale_api` – contains the Funkwhale API logic"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:18
|
||
msgid "`pyproject.toml` – contains the Python requirements"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:19
|
||
msgid "`tests` – contains all tests. This directory matches the structure of the `funkwhale_api` directory"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:21
|
||
msgid "Write tests"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:23
|
||
msgid "You should write tests to ensure that your code does what you expect it to. We use [pytest](https://pytest.org) and [factory-boy](https://factoryboy.readthedocs.io) to power our API testing suite."
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:25
|
||
msgid "Writing tests is outside the scope of this documentation, but here are some useful links to help you get started:"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:27
|
||
msgid "[A quick introduction to writing unit tests with pytest](https://semaphoreci.com/community/tutorials/testing-python-applications-with-pytest)"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:28
|
||
msgid "[A complete guide to Test-Driven Development](https://www.obeythetestinggoat.com/)"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:29
|
||
msgid "[pytest documentation](https://docs.pytest.org/en/latest)"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:30
|
||
msgid "[pytest-mock documentation](https://pypi.org/project/pytest-mock)"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:31
|
||
msgid "[factory-boy documentation](http://factoryboy.readthedocs.io)"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:33
|
||
msgid "Try to keep your tests small and focused. Each test should test a single function, so if you need to test multiple things you should write multiple tests."
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:36
|
||
msgid "Test files must target a module and follow the `funkwhale_api` directory structure. If you write tests for `funkwhale_api/myapp/views.py`, you should put them in `tests/myapp/test_views.py`."
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:39
|
||
msgid "We provide utilities and fixtures to make writing tests as easy as possible. You can see the list of available fixtures by running `docker compose run --rm api pytest --fixtures`."
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:41
|
||
msgid "Factories"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:43
|
||
msgid "Each directory includes a `factories.py` file which contains factories for the models in the directory. You can use these to create arbitrary objects"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:76
|
||
msgid "Mocking"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:78
|
||
msgid "Use mocks to fake logic in your tests. This is useful when testing components that depend on one another."
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:132
|
||
msgid "Run tests"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:134
|
||
msgid "You can run all tests in the pytest suite with the following command:"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:140
|
||
msgid "Run a specific test file by calling pytest against it:"
|
||
msgstr ""
|
||
|
||
#: ../../developer/contribute/api.md:146
|
||
msgid "You can check the full list of options by passing the `-h` flag:"
|
||
msgstr ""
|