feat(tests): add unit tests for settings and forms
New Features - Introduce TestNepkitSettings covering defaults, overrides, and invalid key handling - Add TestDatetimeFormats and TestBSDateFormats verifying default format strings - Extend test coverage for widget attributes and HTMX integration Enhancements - Remove xfail markers and resolve Django app registry timing issues in widget tests Bug Fixes - None
This commit is contained in:
6 files changed
+674
-13
No files matched your search
@@ -2,8 +2,6 @@
|
||||
Tests for django-nepkit widgets.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
from django_nepkit.widgets import (
|
||||
NepaliDatePickerWidget,
|
||||
ProvinceSelectWidget,
|
||||
@@ -15,7 +13,6 @@ from django_nepkit.widgets import (
|
||||
class TestNepaliDatePickerWidget:
|
||||
"""Tests for NepaliDatePickerWidget."""
|
||||
|
||||
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
|
||||
def test_widget_renders_with_class(self):
|
||||
"""Test that widget renders with nepkit-datepicker class."""
|
||||
widget = NepaliDatePickerWidget()
|
||||
@@ -24,7 +21,6 @@ class TestNepaliDatePickerWidget:
|
||||
assert "class=" in html
|
||||
assert "nepkit-datepicker" in html
|
||||
|
||||
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
|
||||
def test_widget_language_attribute_en(self):
|
||||
"""Test that widget renders data-en attribute when en=True."""
|
||||
widget = NepaliDatePickerWidget(en=True)
|
||||
@@ -32,7 +28,6 @@ class TestNepaliDatePickerWidget:
|
||||
|
||||
assert 'data-en="true"' in html
|
||||
|
||||
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
|
||||
def test_widget_language_attribute_ne(self):
|
||||
"""Test that widget renders data-ne attribute when ne=True."""
|
||||
widget = NepaliDatePickerWidget(ne=True)
|
||||
@@ -40,7 +35,6 @@ class TestNepaliDatePickerWidget:
|
||||
|
||||
assert 'data-ne="true"' in html
|
||||
|
||||
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
|
||||
def test_widget_format_attribute(self):
|
||||
"""Test that widget renders data-format attribute."""
|
||||
widget = NepaliDatePickerWidget()
|
||||
@@ -48,7 +42,6 @@ class TestNepaliDatePickerWidget:
|
||||
|
||||
assert "data-format=" in html
|
||||
|
||||
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
|
||||
def test_widget_autocomplete_off(self):
|
||||
"""Test that widget has autocomplete=off."""
|
||||
widget = NepaliDatePickerWidget()
|
||||
@@ -56,7 +49,6 @@ class TestNepaliDatePickerWidget:
|
||||
|
||||
assert 'autocomplete="off"' in html
|
||||
|
||||
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
|
||||
def test_widget_placeholder(self):
|
||||
"""Test that widget has placeholder."""
|
||||
widget = NepaliDatePickerWidget()
|
||||
@@ -68,7 +60,6 @@ class TestNepaliDatePickerWidget:
|
||||
class TestLocationWidgets:
|
||||
"""Tests for location select widgets."""
|
||||
|
||||
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
|
||||
def test_province_widget_renders(self):
|
||||
"""Test that ProvinceSelectWidget renders correctly."""
|
||||
widget = ProvinceSelectWidget()
|
||||
@@ -77,7 +68,6 @@ class TestLocationWidgets:
|
||||
assert "<select" in html
|
||||
assert 'name="province"' in html
|
||||
|
||||
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
|
||||
def test_district_widget_renders(self):
|
||||
"""Test that DistrictSelectWidget renders correctly."""
|
||||
widget = DistrictSelectWidget()
|
||||
@@ -86,7 +76,6 @@ class TestLocationWidgets:
|
||||
assert "<select" in html
|
||||
assert 'name="district"' in html
|
||||
|
||||
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
|
||||
def test_municipality_widget_renders(self):
|
||||
"""Test that MunicipalitySelectWidget renders correctly."""
|
||||
widget = MunicipalitySelectWidget()
|
||||
@@ -104,7 +93,6 @@ class TestLocationWidgets:
|
||||
widget_attrs = context.get("widget", {}).get("attrs", {})
|
||||
assert "hx-get" in widget_attrs or widget.htmx is True
|
||||
|
||||
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
|
||||
def test_location_widget_language_ne(self):
|
||||
"""Test that location widgets respect ne=True."""
|
||||
widget = ProvinceSelectWidget(ne=True)
|
||||
|
||||
Reference in new issue
Block a user