mirror of
https://github.com/barkeser2002/offline-db.git
synced 2026-09-25 04:39:59 +03:00
- Added `bio` field to User model and migrations - Created `UserProfileUpdateSerializer` with RegexValidator (XSS) and Bleach (HTML sanitization) - Updated `ExternalSourceSerializer` to require `https://` or `magnet:` schemes - Replaced insecure extension checking with true MIME validation via `python-magic` in serializers (Subtitles, Images, Banners) - Fixed NextUI floating label overlap bug on magnet link input with `labelPlacement="outside"` and a placeholder. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Senpai-YoloBot <41898282+github-actions[bot]@users.noreply.github.com>
12 lines
557 B
Python
12 lines
557 B
Python
from django.test import TestCase
|
|
from content.serializers import ExternalSourceSerializer, SubtitleSerializer, ImageUploadSerializer
|
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
|
import magic
|
|
|
|
class SerializerValidationTests(TestCase):
|
|
def test_subtitle_file_validation(self):
|
|
invalid_file = SimpleUploadedFile("test.exe", b"MZ\x00\x00\x00", content_type="application/x-msdownload")
|
|
serializer = SubtitleSerializer(data={'file': invalid_file, 'lang': 'en'})
|
|
serializer.is_valid()
|
|
print(serializer.errors)
|