mirror of
https://github.com/boostorg/website-v2.git
synced 2026-01-26 07:02:24 +00:00
Add data JSONField to LibraryVersion model Add fields to library list admin display Add commands to update authors and maintainers individually Exclude data JSONField from view querysets Silence some output from the library-version import management command Remove unused field from the library-version import management command Save library-versions more cleanly in the library-version import management command Remove loading maintainers from the import command, since they now have their own command Add docs for new commands Add boost_setup command to run one command to import all data Add docs on first-time data import Better exception handling, quieter flow, reduce GH API calls Graceful handling if there is not a github repo Pass most recent 12 months to commit counts command Add some user-friendly output to setup command
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
import pytest
|
|
|
|
from django.contrib.auth import get_user_model
|
|
from django.core.management import call_command
|
|
|
|
|
|
User = get_user_model()
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_update_authors_command(library):
|
|
"""Test update_authors Django management command."""
|
|
library.data = {
|
|
"authors": [
|
|
"Jane Smith <jane -at- boost.com>",
|
|
"Juan Rodrigo <juan -at- boost.com>",
|
|
]
|
|
}
|
|
library.save()
|
|
call_command("update_authors")
|
|
assert User.objects.filter(email="jane@boost.com").exists()
|
|
assert User.objects.filter(email="juan@boost.com").exists()
|
|
library.refresh_from_db()
|
|
assert library.authors.count() == 2
|
|
assert library.authors.filter(email="jane@boost.com").exists()
|
|
assert library.authors.filter(email="juan@boost.com").exists()
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_update_maintainers_command(library_version):
|
|
"""Test update_maintainers Django management command."""
|
|
library_version.data = {
|
|
"maintainers": [
|
|
"Jane Smith <jane -at- boost.com>",
|
|
"Juan Rodrigo <juan -at- boost.com>",
|
|
]
|
|
}
|
|
library_version.save()
|
|
call_command("update_maintainers")
|
|
assert User.objects.filter(email="jane@boost.com").exists()
|
|
assert User.objects.filter(email="juan@boost.com").exists()
|
|
library_version.refresh_from_db()
|
|
assert library_version.maintainers.count() == 2
|
|
assert library_version.maintainers.filter(email="jane@boost.com").exists()
|
|
assert library_version.maintainers.filter(email="juan@boost.com").exists()
|