|
3 | 3 |
|
4 | 4 | import pytest |
5 | 5 | from django.core.management import call_command |
| 6 | +from django.core.management import CommandError |
6 | 7 |
|
7 | 8 | from tailwind.utils import get_app_path |
8 | 9 |
|
@@ -140,9 +141,9 @@ def test_tailwind_install_and_build_v4(no_package_lock, settings, app_name): |
140 | 141 |
|
141 | 142 | def test_tailwind_install_and_build_v4_standalone(settings, app_name): |
142 | 143 | """ |
143 | | - GIVEN a new Tailwind v3 app is initialized |
144 | | - WHEN the install and build commands are run with optional package-lock settings |
145 | | - THEN the app structure, dependencies, and CSS output should be created correctly |
| 144 | + GIVEN a new Tailwind v4s (standalone) app is initialized |
| 145 | + WHEN the install and build commands are run |
| 146 | + THEN the app structure should be created correctly |
146 | 147 | """ |
147 | 148 | call_command( |
148 | 149 | "tailwind", "init", "--app-name", app_name, "--no-input", "--tailwind-version", "4s" |
@@ -170,6 +171,28 @@ def test_tailwind_install_and_build_v4_standalone(settings, app_name): |
170 | 171 | ), "Tailwind has built a css/styles.css file" |
171 | 172 |
|
172 | 173 |
|
| 174 | +def test_tailwind_non_standalone_commands_v4_standalone(settings, app_name): |
| 175 | + """ |
| 176 | + GIVEN a new Tailwind v4 standalone app is initialized |
| 177 | + WHEN non-standalone-specific commands are run |
| 178 | + THEN they should raise CommandError indicating they are not supported |
| 179 | + """ |
| 180 | + call_command( |
| 181 | + "tailwind", "init", "--app-name", app_name, "--no-input", "--tailwind-version", "4s" |
| 182 | + ) |
| 183 | + |
| 184 | + settings.INSTALLED_APPS += [app_name] |
| 185 | + settings.TAILWIND_APP_NAME = app_name |
| 186 | + |
| 187 | + call_command("tailwind", "install") |
| 188 | + |
| 189 | + with pytest.raises(CommandError): |
| 190 | + call_command("tailwind", "update") |
| 191 | + |
| 192 | + with pytest.raises(CommandError): |
| 193 | + call_command("tailwind", "plugin_install", "some-plugin") |
| 194 | + |
| 195 | + |
173 | 196 | def test_tailwind_init_with_daisy_ui_v4(settings, app_name): |
174 | 197 | """ |
175 | 198 | GIVEN a new Tailwind v4 app is initialized with the --include-daisy-ui flag |
|
0 commit comments