@@ -0,0 +1,3531 @@
+from django.test import TestCase%0A%0Afrom django.contrib.contenttypes.models import ContentType%0Afrom django.db import connection%0A%0Afrom geotrek.common.models import AccessibilityAttachment, Attachment, Label, TargetPortal%0Afrom geotrek.common.tests.factories import FileTypeFactory%0Afrom geotrek.trekking.tests.factories import TrekFactory%0Afrom geotrek.authent.tests.factories import UserFactory%0A%0A%0Aclass SQLDefaultValuesTest(TestCase):%0A    def test_accessibilityattachment(self):%0A        trek = TrekFactory.create()%0A        user = UserFactory.create()%0A        ct = ContentType.objects.get_by_natural_key('trekking', 'trek')%0A        with connection.cursor() as cur:%0A            cur.execute(f%22%22%22INSERT INTO common_accessibilityattachment%0A                           (%0A                           attachment_accessibility_file,%0A                           content_type_id,%0A                           object_id,%0A                           creator_id%0A                           ) VALUES%0A                           (%0A                           'attachments_accessibility/trekking_trek/1/foo.png',%0A                           %7Bct.pk%7D,%0A                           %7Btrek.pk%7D,%0A                           %7Buser.pk%7D%0A                           )%22%22%22)%0A        accessibility_attachment = AccessibilityAttachment.objects.first()%0A        self.assertEqual(accessibility_attachment.author,%0A                         '')%0A%0A    def test_attachment(self):%0A        trek = TrekFactory.create()%0A        user = UserFactory.create()%0A        filetype = FileTypeFactory.create()%0A        ct = ContentType.objects.get_by_natural_key('trekking', 'trek')%0A        with connection.cursor() as cur:%0A            cur.execute(f%22%22%22INSERT INTO common_attachment%0A                                   (%0A                                   attachment_file,%0A                                   content_type_id,%0A                                   object_id,%0A                                   creator_id,%0A                                   filetype_id%0A                                   ) VALUES%0A                                   (%0A                                   'attachments/trekking_trek/1/foo.png',%0A                                   %7Bct.pk%7D,%0A                                   %7Btrek.pk%7D,%0A                                   %7Buser.pk%7D,%0A                                   %7Bfiletype.pk%7D%0A                                   )%22%22%22)%0A        attachment = Attachment.objects.first()%0A        self.assertEqual(attachment.author, '')%0A%0A    def test_target_portal(self):%0A        with connection.cursor() as cur:%0A            cur.execute(f%22%22%22INSERT INTO common_targetportal%0A                                   (%0A                                   name,%0A                                   website%0A                                   ) VALUES%0A                                   (%0A                                   'name_target',%0A                                   'http://foo.com'%0A                                   )%22%22%22)%0A        target_portal = TargetPortal.objects.first()%0A        self.assertEqual(target_portal.facebook_image_url, '/images/logo-geotrek.png')%0A%0A    def test_label(self):%0A        with connection.cursor() as cur:%0A            cur.execute(f%22%22%22INSERT INTO common_label%0A                                   (%0A                                   name%0A                                   ) VALUES%0A                                   (%0A                                   'name_label'%0A                                   )%22%22%22)%0A        label = Label.objects.first()%0A        self.assertFalse(label.filter)%0A

Add test sql common