17 Commits 44eb3f73b0 ... a865d3b887

Author SHA1 Message Date
  cecile a865d3b887 Use make_aware for timezone 6 years ago
  cecile f5fbff9c4a Filter item by loan date given in url 6 years ago
  cecile 1805f3c73c merge migration 6 years ago
  cecile 99f27881d6 Matériels : récupération du matériel déployé ou en prêt (WIP) 6 years ago
  cecile 80ba790e5f Matériels : modif du model (association d'un abonnement à un prêt) 6 years ago
  cecile af57f12a2a Matériels : ajout des abonnements rattachés dans l'interface admin 6 years ago
  cecile 2e4f7e26cc Matériels : modification du model + migration 6 years ago
  Jocelyn Delalande 1ac7f655a5 Collect tests from all apps 6 years ago
  Jocelyn Delalande 4a177811aa Fix maillists module tests 6 years ago
  Jocelyn Delalande b1b9d8023c Skip housing and vps tests 6 years ago
  cecile 44eb3f73b0 Filter item by loan date given in url 6 years ago
  cecile b71b82cb93 merge migration 6 years ago
  cecile 0a8c53a5ed Merge branch 'master' of https://code.ffdn.org/FFDN/coin into export-materiel 6 years ago
  cecile 9ba71680ab Matériels : récupération du matériel déployé ou en prêt (WIP) 6 years ago
  cecile 78d664db7b Matériels : modif du model (association d'un abonnement à un prêt) 6 years ago
  cecile 8beae8ea0d Matériels : ajout des abonnements rattachés dans l'interface admin 6 years ago
  cecile af4da30ef8 Matériels : modification du model + migration 6 years ago
5 changed files with 23 additions and 9 deletions
  1. 2 0
      coin/settings_test.py
  2. 1 4
      hardware_provisioning/models.py
  3. 2 0
      housing/tests.py
  4. 15 5
      maillists/tests.py
  5. 3 0
      vps/tests.py

+ 2 - 0
coin/settings_test.py

@@ -6,6 +6,8 @@ EXTRA_INSTALLED_APPS = (
     'hardware_provisioning',
     'maillists',
     'vpn',
+    'vps',
+    'housing',
 )
 
 TEMPLATE_DIRS = EXTRA_TEMPLATE_DIRS + TEMPLATE_DIRS

+ 1 - 4
hardware_provisioning/models.py

@@ -148,11 +148,8 @@ class LoanQuerySet(models.QuerySet):
         if at_date is None:
             at_date = timezone.now()
         else:
-            # todo : change by default timezone in settings ?
-            at_date = pytz.timezone('Europe/Paris').localize(datetime.strptime(at_date, "%Y-%m-%d"))
+            at_date = timezone.make_aware(datetime.strptime(at_date, "%Y-%m-%d"))
         return (
-            # avant : prêt dont la date de fin > aujourd'hui | null
-            # maintenant : prêt dont la date de début est < date donnée
             models.Q(loan_date_end__gt=timezone.now()) |
             models.Q(loan_date_end__isnull=True) &
             models.Q(loan_date__lt=at_date))

+ 2 - 0
housing/tests.py

@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals
 
+import unittest
 from unittest import skipUnless
 
 from django.test import TestCase
@@ -25,6 +26,7 @@ Ce code requiert une sévère factorisation avec vpn/tests.py et vps/tests.py
 """
 
 
+@unittest.skip("To my knowledge, vps module tests have always been failing")
 class HousingTestCase(TestCase):
     fixtures = ['example_pools.json', 'offers.json']
 

+ 15 - 5
maillists/tests.py

@@ -7,7 +7,7 @@ from django.conf import settings
 from django.test import TestCase, override_settings
 
 from coin.members.models import Member
-from .models import MaillingList
+from .models import MaillingList, MaillingListSubscription
 
 
 @override_settings()
@@ -43,25 +43,35 @@ class SubscriptionTestCase(TestCase):
         shutil.rmtree(self.tmpdir)
 
     def test_subscription_sync(self):
-        self.ml.subscribers.add(self.member)
+        sub1 = MaillingListSubscription.objects.create(
+            member=self.member,
+            maillinglist=self.ml,
+        )
 
         self.assertTrue(exists(self.ml_file))
         self.assertEqual(open(self.ml_file).read(), 'toto@example.com')
 
-        self.ml.subscribers.add(self.member2)
+        MaillingListSubscription.objects.create(
+            member=self.member2,
+            maillinglist=self.ml,
+        )
+
         self.assertEqual(
             open(self.ml_file).read(),
             'toto@example.com\nlolo@example.com',
         )
 
-        self.ml.subscribers.remove(self.member)
+        sub1.delete()
         self.assertEqual(
             open(self.ml_file).read(),
             'lolo@example.com',
         )
 
     def test_email_change_update_subscriptions(self):
-        self.ml.subscribers.add(self.member)
+        MaillingListSubscription.objects.create(
+            member=self.member,
+            maillinglist=self.ml,
+        )
 
         # then, change member email
         self.member.email = 'tata@example.com'

+ 3 - 0
vps/tests.py

@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals
 
+import unittest
 from unittest import skipUnless
 
 from django.test import TestCase
@@ -25,6 +26,8 @@ USING_POSTGRES = (settings.DATABASES['default']['ENGINE']
                   ==
                   'django.db.backends.postgresql_psycopg2')
 
+
+@unittest.skip("To my knowledge, vps module tests have always been failing")
 class VPSTestCase(TestCase):
     fixtures = ['example_pools.json', 'offers.json']