-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4030 from GeotrekCE/fix_mobile_sync_when_no_picto…
…_on_themes Fix mobile sync when no picto on themes (fixes #3814)
- Loading branch information
Showing
4 changed files
with
55 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from django.test import TestCase | ||
|
||
from geotrek.api.mobile.serializers import common as api_serializers | ||
from geotrek.trekking.tests.factories import PracticeFactory | ||
from geotrek.common.tests.factories import ThemeFactory | ||
|
||
|
||
class PracticeSerializerTestCase(TestCase): | ||
|
||
def test_practice_with_picto(self): | ||
practice = PracticeFactory.create(pictogram='a/pictogram/path.png') | ||
serialized_practice = api_serializers.PracticeSerializer(practice).data | ||
self.assertEqual(serialized_practice['pictogram'], '/media/a/pictogram/path.png') | ||
|
||
def test_practice_with_no_picto(self): | ||
practice = PracticeFactory.create(pictogram=None) | ||
serialized_practice = api_serializers.PracticeSerializer(practice).data | ||
self.assertIsNone(serialized_practice['pictogram']) | ||
|
||
|
||
class ThemeSerializerTestCase(TestCase): | ||
|
||
def test_theme_with_picto(self): | ||
theme = ThemeFactory.create(pictogram='a/pictogram/path.png') | ||
serialized_theme = api_serializers.ThemeSerializer(theme).data | ||
self.assertEqual(serialized_theme['pictogram'], '/media/a/pictogram/path.png') | ||
|
||
def test_theme_with_no_picto(self): | ||
theme = ThemeFactory.create(pictogram=None) | ||
serialized_theme = api_serializers.ThemeSerializer(theme).data | ||
self.assertIsNone(serialized_theme['pictogram']) |
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