Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Set the description source in test exercise data

Roland Geidera449e0cb90ba
diff --git a/wger/exercises/fixtures/test-exercises.json b/wger/exercises/fixtures/test-exercises.json
index c58ae222f..9eda3d2e5 100644
--- a/wger/exercises/fixtures/test-exercises.json
+++ b/wger/exercises/fixtures/test-exercises.json
@@ -120,6 +120,7 @@
"language": 2,
"exercise": 1,
"description": "Lorem ipsum dolor sit amet",
+ "description_source": "Lorem ipsum dolor sit amet",
"name": "An exercise",
"created": "2002-08-15T00:00:00+01:00",
"last_update": "2008-08-08T08:08:08+01:00"
@@ -133,6 +134,7 @@
"language": 2,
"exercise": 2,
"description": "",
+ "description_source": "",
"name": "Very cool exercise",
"created": "2022-01-10T00:00:00+01:00",
"last_update": "2022-02-02T06:45:11+01:00"
@@ -146,6 +148,7 @@
"language": 2,
"exercise": 3,
"description": "",
+ "description_source": "",
"name": "Boring exercise",
"created": "2022-01-10T00:00:00+01:00",
"last_update": "2022-02-02T06:45:11+01:00"
@@ -158,6 +161,7 @@
"uuid": "5e80d257-3ece-43a1-b01d-2b28c6c288be",
"language": 2,
"description": "",
+ "description_source": "",
"exercise": 4,
"license_author": "test",
"name": "Pending exercise",
@@ -172,6 +176,7 @@
"uuid": "13b532f9-d208-462e-a000-7b9982b2b53e",
"language": 3,
"description": "",
+ "description_source": "",
"exercise": 1,
"license_author": "test",
"name": "Test exercise 123",
@@ -186,6 +191,7 @@
"uuid": "e75335be-5177-4475-b17b-8d833c2aadf1",
"language": 3,
"description": "",
+ "description_source": "",
"exercise": 3,
"license_author": "test",
"name": "Some other exercise",
@@ -201,6 +207,7 @@
"language": 1,
"exercise": 4,
"description": "",
+ "description_source": "",
"name": "Weitere Testübung",
"created": "2022-01-10T00:00:00+01:00",
"last_update": "2022-02-02T06:45:11+01:00"
@@ -214,6 +221,7 @@
"language": 2,
"exercise": 5,
"description": "",
+ "description_source": "",
"name": "Needed for demo user",
"created": "2022-01-10T00:00:00+01:00",
"last_update": "2022-02-02T06:45:11+01:00"
@@ -227,6 +235,7 @@
"language": 2,
"exercise": 6,
"description": "",
+ "description_source": "",
"name": "Needed for demo user",
"created": "2022-01-10T00:00:00+01:00",
"last_update": "2022-02-02T06:45:11+01:00"
@@ -240,6 +249,7 @@
"language": 2,
"exercise": 7,
"description": "",
+ "description_source": "",
"name": "Needed for demo user",
"created": "2022-01-10T00:00:00+01:00",
"last_update": "2022-02-02T06:45:11+01:00"
@@ -253,6 +263,7 @@
"language": 2,
"exercise": 8,
"description": "",
+ "description_source": "",
"name": "Needed for demo user",
"created": "2022-01-10T00:00:00+01:00",
"last_update": "2022-02-02T06:45:11+01:00"
diff --git a/wger/exercises/tests/test_exercise_translation.py b/wger/exercises/tests/test_exercise_translation.py
index 74d053548..d80727b3c 100644
--- a/wger/exercises/tests/test_exercise_translation.py
+++ b/wger/exercises/tests/test_exercise_translation.py
@@ -232,11 +232,11 @@ class ExerciseTranslationCustomApiTestCase(ExerciseCrudApiTestCase):
def test_patch_clean_html(self):
"""
- Test that the description field has its HTML stripped before saving
+ Test that HTML in description_source is sanitized (script tags stripped) before saving
"""
description = '<script>alert();</script> The wild boar is a suid native...'
self.authenticate('trainer1')
- response = self.client.patch(self.url_detail, data={'description': description})
+ response = self.client.patch(self.url_detail, data={'description_source': description})
self.assertEqual(response.status_code, status.HTTP_200_OK)
translation = Translation.objects.get(pk=self.pk)