forked from django-oscar/django-oscar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] Offer's slug doesn't support unicode (django-oscar#4172)
* fix 🔧 add unicode support in slug urls * feat ⭐ add tests to check urls with unicode characters
- Loading branch information
1 parent
66c771b
commit 1c25682
Showing
7 changed files
with
76 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,37 @@ | ||
from django.test import TestCase | ||
|
||
from oscar.test.factories.offer import ( | ||
BenefitFactory, | ||
ConditionalOfferFactory, | ||
ConditionFactory, | ||
RangeFactory, | ||
) | ||
from oscar.test.testcases import WebTestCase | ||
|
||
|
||
class TestTheOfferListPage(WebTestCase): | ||
def test_exists(self): | ||
response = self.app.get("/offers/") | ||
self.assertEqual(200, response.status_code) | ||
|
||
|
||
class TestOfferDetailsPageWithUnicodeSlug(TestCase): | ||
def setUp(self): | ||
self.slug = "Ûul-wįth-weird-chars" | ||
self.offer = ConditionalOfferFactory( | ||
condition=ConditionFactory(), benefit=BenefitFactory(), slug=self.slug | ||
) | ||
|
||
def test_url_with_unicode_characters(self): | ||
response = self.client.get(f"/offers/{self.slug}/") | ||
self.assertEqual(200, response.status_code) | ||
|
||
|
||
class TestRangeDetailsPageWithUnicodeSlug(TestCase): | ||
def setUp(self): | ||
self.slug = "Ûul-wįth-weird-chars" | ||
self.range = RangeFactory(slug=self.slug, is_public=True) | ||
|
||
def test_url_with_unicode_characters(self): | ||
response = self.client.get(f"/catalogue/ranges/{self.slug}/") | ||
self.assertEqual(200, response.status_code) |