pytest-django-admin-kit 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. pytest_django_admin_kit-1.0.0/.gitignore +219 -0
  2. pytest_django_admin_kit-1.0.0/CHANGELOG.md +83 -0
  3. pytest_django_admin_kit-1.0.0/LICENSE +21 -0
  4. pytest_django_admin_kit-1.0.0/PKG-INFO +951 -0
  5. pytest_django_admin_kit-1.0.0/README.md +888 -0
  6. pytest_django_admin_kit-1.0.0/RELEASING.md +60 -0
  7. pytest_django_admin_kit-1.0.0/pyproject.toml +146 -0
  8. pytest_django_admin_kit-1.0.0/specification.md +2937 -0
  9. pytest_django_admin_kit-1.0.0/src/django_admin_kit/__init__.py +16 -0
  10. pytest_django_admin_kit-1.0.0/src/django_admin_kit/config.py +205 -0
  11. pytest_django_admin_kit-1.0.0/src/django_admin_kit/errors.py +64 -0
  12. pytest_django_admin_kit-1.0.0/src/django_admin_kit/fields.py +246 -0
  13. pytest_django_admin_kit-1.0.0/src/django_admin_kit/matching.py +178 -0
  14. pytest_django_admin_kit-1.0.0/src/django_admin_kit/messages.py +121 -0
  15. pytest_django_admin_kit-1.0.0/src/django_admin_kit/normalize.py +153 -0
  16. pytest_django_admin_kit-1.0.0/src/django_admin_kit/pages.py +841 -0
  17. pytest_django_admin_kit-1.0.0/src/django_admin_kit/plugin.py +169 -0
  18. pytest_django_admin_kit-1.0.0/src/django_admin_kit/py.typed +0 -0
  19. pytest_django_admin_kit-1.0.0/src/django_admin_kit/rendered.py +143 -0
  20. pytest_django_admin_kit-1.0.0/src/django_admin_kit/results.py +62 -0
  21. pytest_django_admin_kit-1.0.0/src/django_admin_kit/rows.py +165 -0
  22. pytest_django_admin_kit-1.0.0/src/django_admin_kit/session.py +132 -0
  23. pytest_django_admin_kit-1.0.0/src/django_admin_kit/tools.py +27 -0
  24. pytest_django_admin_kit-1.0.0/src/django_admin_kit/urls.py +122 -0
  25. pytest_django_admin_kit-1.0.0/src/django_admin_kit/widgets.py +172 -0
  26. pytest_django_admin_kit-1.0.0/tests/conftest.py +122 -0
  27. pytest_django_admin_kit-1.0.0/tests/project/__init__.py +0 -0
  28. pytest_django_admin_kit-1.0.0/tests/project/accounts/__init__.py +0 -0
  29. pytest_django_admin_kit-1.0.0/tests/project/accounts/apps.py +6 -0
  30. pytest_django_admin_kit-1.0.0/tests/project/accounts/migrations/0001_initial.py +39 -0
  31. pytest_django_admin_kit-1.0.0/tests/project/accounts/migrations/__init__.py +0 -0
  32. pytest_django_admin_kit-1.0.0/tests/project/accounts/models.py +58 -0
  33. pytest_django_admin_kit-1.0.0/tests/project/ops.py +13 -0
  34. pytest_django_admin_kit-1.0.0/tests/project/settings.py +79 -0
  35. pytest_django_admin_kit-1.0.0/tests/project/shop/__init__.py +0 -0
  36. pytest_django_admin_kit-1.0.0/tests/project/shop/admin.py +183 -0
  37. pytest_django_admin_kit-1.0.0/tests/project/shop/apps.py +6 -0
  38. pytest_django_admin_kit-1.0.0/tests/project/shop/kit_widgets.py +60 -0
  39. pytest_django_admin_kit-1.0.0/tests/project/shop/migrations/0001_initial.py +51 -0
  40. pytest_django_admin_kit-1.0.0/tests/project/shop/migrations/0002_review.py +25 -0
  41. pytest_django_admin_kit-1.0.0/tests/project/shop/migrations/0003_feed_refresh.py +23 -0
  42. pytest_django_admin_kit-1.0.0/tests/project/shop/migrations/0004_feed_color.py +16 -0
  43. pytest_django_admin_kit-1.0.0/tests/project/shop/migrations/__init__.py +0 -0
  44. pytest_django_admin_kit-1.0.0/tests/project/shop/models.py +71 -0
  45. pytest_django_admin_kit-1.0.0/tests/project/shop/rules.py +29 -0
  46. pytest_django_admin_kit-1.0.0/tests/project/shop/templates/admin/shop/feed/submit_line.html +7 -0
  47. pytest_django_admin_kit-1.0.0/tests/project/shop/templates/shop/widgets/swatch_picker.html +24 -0
  48. pytest_django_admin_kit-1.0.0/tests/project/shop/widgets.py +16 -0
  49. pytest_django_admin_kit-1.0.0/tests/project/urls.py +6 -0
  50. pytest_django_admin_kit-1.0.0/tests/project/urls_backoffice.py +8 -0
  51. pytest_django_admin_kit-1.0.0/tests/project/urls_with_ops.py +11 -0
  52. pytest_django_admin_kit-1.0.0/tests/test_actions.py +136 -0
  53. pytest_django_admin_kit-1.0.0/tests/test_changelist.py +186 -0
  54. pytest_django_admin_kit-1.0.0/tests/test_changelist_count.py +104 -0
  55. pytest_django_admin_kit-1.0.0/tests/test_choices.py +65 -0
  56. pytest_django_admin_kit-1.0.0/tests/test_config.py +221 -0
  57. pytest_django_admin_kit-1.0.0/tests/test_confirm_delete.py +180 -0
  58. pytest_django_admin_kit-1.0.0/tests/test_create.py +61 -0
  59. pytest_django_admin_kit-1.0.0/tests/test_custom_prefix.py +24 -0
  60. pytest_django_admin_kit-1.0.0/tests/test_custom_site.py +72 -0
  61. pytest_django_admin_kit-1.0.0/tests/test_custom_user.py +67 -0
  62. pytest_django_admin_kit-1.0.0/tests/test_delete.py +106 -0
  63. pytest_django_admin_kit-1.0.0/tests/test_delete_contents.py +202 -0
  64. pytest_django_admin_kit-1.0.0/tests/test_edit.py +76 -0
  65. pytest_django_admin_kit-1.0.0/tests/test_errors.py +170 -0
  66. pytest_django_admin_kit-1.0.0/tests/test_fields.py +501 -0
  67. pytest_django_admin_kit-1.0.0/tests/test_index.py +97 -0
  68. pytest_django_admin_kit-1.0.0/tests/test_interop.py +88 -0
  69. pytest_django_admin_kit-1.0.0/tests/test_links.py +69 -0
  70. pytest_django_admin_kit-1.0.0/tests/test_live.py +106 -0
  71. pytest_django_admin_kit-1.0.0/tests/test_matching.py +422 -0
  72. pytest_django_admin_kit-1.0.0/tests/test_messages.py +269 -0
  73. pytest_django_admin_kit-1.0.0/tests/test_normalizers.py +182 -0
  74. pytest_django_admin_kit-1.0.0/tests/test_package.py +15 -0
  75. pytest_django_admin_kit-1.0.0/tests/test_pages.py +88 -0
  76. pytest_django_admin_kit-1.0.0/tests/test_plugin.py +121 -0
  77. pytest_django_admin_kit-1.0.0/tests/test_populate.py +560 -0
  78. pytest_django_admin_kit-1.0.0/tests/test_project.py +46 -0
  79. pytest_django_admin_kit-1.0.0/tests/test_rows.py +348 -0
  80. pytest_django_admin_kit-1.0.0/tests/test_session.py +141 -0
  81. pytest_django_admin_kit-1.0.0/tests/test_submit.py +400 -0
  82. pytest_django_admin_kit-1.0.0/tests/test_urls.py +90 -0
  83. pytest_django_admin_kit-1.0.0/tests/test_widgets.py +256 -0
  84. pytest_django_admin_kit-1.0.0/tox.toml +77 -0
@@ -0,0 +1,219 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # uv.lock IS committed, so it is not listed here. It pins the development toolchain, so
99
+ # every contributor gets the same ruff and mypy and therefore the same results. It says
100
+ # nothing about the version matrix, which tox resolves per cell.
101
+
102
+ # poetry
103
+ # Not used by this project; uv manages environments. Kept ignored so that running
104
+ # Poetry by accident leaves nothing behind.
105
+ poetry.lock
106
+ poetry.toml
107
+
108
+ # pdm
109
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
110
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
111
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
112
+ # pdm.lock
113
+ # pdm.toml
114
+ .pdm-python
115
+ .pdm-build/
116
+
117
+ # pixi
118
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
119
+ # pixi.lock
120
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
121
+ # in the .venv directory. It is recommended not to include this directory in version control.
122
+ .pixi
123
+
124
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
125
+ __pypackages__/
126
+
127
+ # Celery stuff
128
+ celerybeat-schedule
129
+ celerybeat.pid
130
+
131
+ # Redis
132
+ *.rdb
133
+ *.aof
134
+ *.pid
135
+
136
+ # RabbitMQ
137
+ mnesia/
138
+ rabbitmq/
139
+ rabbitmq-data/
140
+
141
+ # ActiveMQ
142
+ activemq-data/
143
+
144
+ # SageMath parsed files
145
+ *.sage.py
146
+
147
+ # Environments
148
+ .env
149
+ .envrc
150
+ .venv
151
+ env/
152
+ venv/
153
+ ENV/
154
+ env.bak/
155
+ venv.bak/
156
+
157
+ # Spyder project settings
158
+ .spyderproject
159
+ .spyproject
160
+
161
+ # Rope project settings
162
+ .ropeproject
163
+
164
+ # mkdocs documentation
165
+ /site
166
+
167
+ # mypy
168
+ .mypy_cache/
169
+ .dmypy.json
170
+ dmypy.json
171
+
172
+ # Pyre type checker
173
+ .pyre/
174
+
175
+ # pytype static type analyzer
176
+ .pytype/
177
+
178
+ # Cython debug symbols
179
+ cython_debug/
180
+
181
+ # PyCharm
182
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
183
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
184
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
185
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
186
+ .idea/
187
+
188
+ # Abstra
189
+ # Abstra is an AI-powered process automation framework.
190
+ # Ignore directories containing user credentials, local state, and settings.
191
+ # Learn more at https://abstra.io/docs
192
+ .abstra/
193
+
194
+ # Visual Studio Code
195
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
196
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
197
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
198
+ # you could uncomment the following to ignore the entire vscode folder
199
+ # .vscode/
200
+ # Temporary file for partial code execution
201
+ tempCodeRunnerFile.py
202
+
203
+ # Ruff stuff:
204
+ .ruff_cache/
205
+
206
+ # PyPI configuration file
207
+ .pypirc
208
+
209
+ # Marimo
210
+ marimo/_static/
211
+ marimo/_lsp/
212
+ __marimo__/
213
+
214
+ # Streamlit
215
+ .streamlit/secrets.toml
216
+
217
+ # Browser test artifacts (videos, traces, screenshots). The browser plugin writes
218
+ # these under --output and deletes the directory at the start of every session.
219
+ test-results/
@@ -0,0 +1,83 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are listed in this file.
4
+
5
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
6
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-10-13
9
+
10
+ The first release. Tests open the Django admin in a real browser and check it with plain
11
+ `assert` statements.
12
+
13
+ ### Added
14
+
15
+ - The `admin_ui` fixture. It opens admin pages in a real browser against a live server.
16
+ - Log in as any user with `admin_ui.login(user)`. No password is needed, and custom user models
17
+ work.
18
+ - Test the login page itself with `admin_ui.login(user, password="...")`.
19
+ - Log out with `admin_ui.logout()`.
20
+ - Open the index, a changelist, a create page, an edit page or a delete page with
21
+ `admin_ui.index()`, `admin_ui.list(Model)`, `admin_ui.create(Model)`, `admin_ui.edit(obj)` and
22
+ `admin_ui.delete(obj)`.
23
+ - Open any other admin page by its path with `admin_ui.open(path)`.
24
+ - See if a page opened with `page.works`. See why it did not with `page.denied`, `page.missing`,
25
+ `page.redirected` and `page.status_code`.
26
+ - Read the title and subtitle of a page with `page.title` and `page.subtitle`.
27
+ - Get admin URLs without writing `/admin/` in tests, with `admin_ui.url.index()`,
28
+ `admin_ui.url.list(Model)`, `admin_ui.url.create(Model)`, `admin_ui.url.edit(obj)`,
29
+ `admin_ui.url.delete(obj)` and `admin_ui.url.login()`.
30
+ - Read the models and apps the index shows to the current user with `page.models`,
31
+ `page.apps` and `page.models_for()`.
32
+ - Read changelist columns by label with `page.headers` and by name with `page.columns`.
33
+ - Read the number of records with `page.count`, and check an empty list with `page.empty`.
34
+ - Read rows and cells with `page.rows[0]["email"].value`.
35
+ - Read cells as the user sees them: icons become `True`, `False` or `None`, and links become
36
+ their text, with the targets in `cell.links`.
37
+ - Check that a changelist has a row with `page.contains(...)`, and check all rows in order with
38
+ `page.match([...])`.
39
+ - Use `ANY` for a cell you do not care about, `ANY_ROW` for a row you do not care about, and a
40
+ function for a cell that needs its own check.
41
+ - Write an expected row as a tuple of all cells, or as a dictionary of only the columns you care
42
+ about.
43
+ - See the expected row and the real rows in the error message when a row does not match.
44
+ - Read the fields of a create or edit page by name with `page.fields`, in the order the admin
45
+ shows them.
46
+ - Read a field's label, value, choices and errors, and check if it is required or editable.
47
+ - Get the required and the optional fields with `page.required_fields` and
48
+ `page.optional_fields`.
49
+ - Fill one field with `field.fill(value)`.
50
+ - Fill many fields in one call with `page.populate(...)`, from a dictionary, an object, a model
51
+ instance or keyword arguments.
52
+ - Fill only the required fields, only the optional fields, or all of them, with
53
+ `PagePopulationMode`.
54
+ - See which buttons a form offers with `page.actions`, `page.has_action()` and checks such as
55
+ `page.can_save`.
56
+ - Submit a form with `save()`, `save_and_continue()`, `save_and_add_another()`,
57
+ `save_as_new()`, or any button by its name with `submit()`.
58
+ - See if the admin accepted a form with `result.success`, and where it went next with
59
+ `result.redirected_to()` and its short forms.
60
+ - Read the page the admin showed after a submission with `result.page`.
61
+ - Read form errors at three levels: the notice at the top, errors of the whole form, and errors
62
+ of each field.
63
+ - Read the messages the admin shows after an action with `page.messages` and
64
+ `page.messages.of_level()`.
65
+ - Delete an object in two steps, as the admin does, with `delete()` and `confirm_deleting()`.
66
+ - Read what a deletion will remove with `page.deletions` and `page.deletion_counts`, and what
67
+ stops it with `page.blockers`.
68
+ - Every value is read from the page at the moment you ask for it, so it is always up to date.
69
+ - Reach the Playwright object behind a page, a field, a row or a cell with `.native`.
70
+ - Configure the package in one place, the `DJANGO_ADMIN_KIT` setting. Wrong keys and values fail
71
+ at once with a clear message.
72
+ - Test another admin site, also one under a different URL prefix, with the `site` setting or the
73
+ `admin_ui_urls` fixture.
74
+ - The browser uses the time zone and language of your project, so results are the same on every
75
+ machine.
76
+ - Replace any rule that reads values, such as dates or numbers, with the `normalizers` setting.
77
+ - Teach the package to read and fill your own widgets with the `widgets` setting.
78
+ - Change the rules or the widgets for one folder, one module or one test by overriding the
79
+ `admin_ui_normalizers` or `admin_ui_widgets` fixture.
80
+ - Tests can run in parallel, and every test starts logged out.
81
+ - Works with Python 3.8 to 3.14 and Django 3.2 to 6.1.
82
+
83
+ [1.0.0]: https://github.com/JeyKip/pytest-django-admin-kit/releases/tag/v1.0.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yevhen Nosolenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.