Skip to content

Commit

Permalink
Organize models and fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
TysonRV committed Oct 12, 2020
1 parent 6ca64b1 commit 68ac43e
Show file tree
Hide file tree
Showing 7 changed files with 539 additions and 95 deletions.
12 changes: 0 additions & 12 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ werkzeug = "*" # support for werkzeug debugger in runserver_plus
ipython = "*" # enhanced python shell
ipdb = "*" # ipython breakpoints
django-extensions = "*" # Django Sugar for development
dj-database-url = "*" # Parsing of database urls
flake9 = "*" # Static code checking (with pyproject.toml support)
pytest = "*" # Test runner
pytest-django = "*" # Django integration for pytest
Expand Down
47 changes: 26 additions & 21 deletions tests/test_admin_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ def test_login(client, admin_user):
assert templates_used == ["admin/login.html"]

response = client.post(
url + "?next=/admin/", data={"username": admin_user.username, "password": "password"}, follow=True
url + "?next=/admin/",
data={
"username": admin_user.username,
"password": "password"
},
follow=True
)

assert response.status_code == 200
Expand Down Expand Up @@ -68,7 +73,11 @@ def test_password_change(admin_client):

response = admin_client.post(
url,
data={"old_password": "password", "new_password1": "PickleRick123!!", "new_password2": "PickleRick123!!"},
data={
"old_password": "password",
"new_password1": "PickleRick123!!",
"new_password2": "PickleRick123!!"
},
follow=True,
)
templates_used = [t.name for t in response.templates]
Expand Down Expand Up @@ -116,30 +125,28 @@ def test_detail(admin_client, test_data):

# The number of times each template was rendered
assert render_counts == {
"admin/widgets/split_datetime.html": 1,
"django/forms/widgets/splithiddendatetime.html": 1,
"admin/change_form_object_tools.html": 1,
"django/forms/widgets/checkbox.html": 4,
"admin/base.html": 1,
"admin/base_site.html": 1,
"admin/change_form.html": 1,
"admin/change_form_object_tools.html": 1,
"admin/edit_inline/stacked.html": 1,
"admin/includes/fieldset.html": 7,
"admin/prepopulated_fields_js.html": 1,
"django/forms/widgets/date.html": 2,
"django/forms/widgets/textarea.html": 1,
"admin/base_site.html": 1,
"admin/submit_line.html": 1,
"admin/widgets/foreign_key_raw_id.html": 1,
"admin/includes/fieldset.html": 7,
"admin/widgets/split_datetime.html": 1,
"django/forms/widgets/date.html": 2,
"django/forms/widgets/attrs.html": 34,
"django/forms/widgets/checkbox.html": 4,
"django/forms/widgets/hidden.html": 14,
"django/forms/widgets/attrs.html": 49,
"django/forms/widgets/select.html": 5,
"admin/edit_inline/stacked.html": 1,
"django/forms/widgets/text.html": 5,
"django/forms/widgets/input.html": 28,
"admin/base.html": 1,
"django/forms/widgets/select_option.html": 15,
"django/forms/widgets/input.html": 33,
"django/forms/widgets/multiwidget.html": 1,
"jazzmin/includes/horizontal_tabs.html": 1,
"django/forms/widgets/splithiddendatetime.html": 1,
"django/forms/widgets/textarea.html": 1,
"django/forms/widgets/text.html": 10,
"django/forms/widgets/time.html": 2,
"jazzmin/includes/horizontal_tabs.html": 1,
"jazzmin/includes/ui_builder_panel.html": 1,
"admin/submit_line.html": 1,
}

# The templates that were used
Expand All @@ -157,12 +164,10 @@ def test_detail(admin_client, test_data):
"admin/includes/fieldset.html",
"django/forms/widgets/hidden.html",
"django/forms/widgets/attrs.html",
"django/forms/widgets/select.html",
"admin/edit_inline/stacked.html",
"django/forms/widgets/text.html",
"django/forms/widgets/input.html",
"admin/base.html",
"django/forms/widgets/select_option.html",
"django/forms/widgets/multiwidget.html",
"jazzmin/includes/horizontal_tabs.html",
"django/forms/widgets/time.html",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_app/polls/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class PollAdmin(admin.ModelAdmin):

@admin.register(Choice)
class ChoiceAdmin(admin.ModelAdmin):
list_display = ("poll", "choice_text")
list_display = ("poll", "choice_text", "time")
list_per_page = 20
list_editable = ("choice_text",)
list_editable = ("choice_text", "time")
autocomplete_fields = ("poll",)


Expand Down
Loading

0 comments on commit 68ac43e

Please sign in to comment.