Browse Source

Adapt test with polymorphic integration. But they are not actually passing. work in progress.

Fabs 10 years ago
parent
commit
d2ebc37ccb
2 changed files with 11 additions and 16 deletions
  1. 5 10
      coin/offers/fixtures/offers.json
  2. 6 6
      coin/vpn/tests.py

+ 5 - 10
coin/offers/fixtures/offers.json

@@ -7,8 +7,7 @@
             "name": "VPN standard",
             "initial_fees": "0.00",
             "period_fees": "8.00",
-            "type": "VPN",
-            "backend": "openvpn_ldap"
+            "configuration_type": "VPNConfiguration"
         }
     },
     {
@@ -19,8 +18,7 @@
             "name": "VPN préférentiel",
             "initial_fees": "0.00",
             "period_fees": "5.00",
-            "type": "VPN",
-            "backend": "openvpn_ldap"
+            "configuration_type": "VPNConfiguration"
         }
     },
     {
@@ -31,8 +29,7 @@
             "name": "VPN gratuit",
             "initial_fees": "0.00",
             "period_fees": "0.00",
-            "type": "VPN",
-            "backend": "openvpn_ldap"
+            "configuration_type": "VPNConfiguration"
         }
     },
     {
@@ -43,8 +40,7 @@
             "name": "Marque blanche FDN",
             "initial_fees": "70.00",
             "period_fees": "32.00",
-            "type": "ADSL",
-            "backend": "none"
+            "configuration_type": "none"
         }
     },
     {
@@ -55,8 +51,7 @@
             "name": "Marque blanche FDN (préférentiel)",
             "initial_fees": "70.00",
             "period_fees": "28.00",
-            "type": "ADSL",
-            "backend": "none"
+            "configuration_type": "none"
         }
     }
 ]

+ 6 - 6
coin/vpn/tests.py

@@ -13,7 +13,7 @@ class VPNTestCase(TestCase):
     def setUp(self):
         self.v6_pool = IPPool.objects.get(default_subnetsize=56)
         self.v4_pool = IPPool.objects.get(default_subnetsize=32)
-        self.offer = Offer.objects.filter(backend="openvpn_ldap")[0]
+        self.offer = Offer.objects.filter(configuration_type="VPNConfiguration")[0]
 
         # Create a member.
         cn = MemberTestsUtils.get_random_ldap_cn()
@@ -32,7 +32,7 @@ class VPNTestCase(TestCase):
         v4 = IPSubnet(ip_pool=self.v4_pool, offer_subscription=abo)
         v4.full_clean()
         v4.save()
-        vpn = VPNConfiguration(administrative_subscription=abo)
+        vpn = VPNConfiguration(offersubscription=abo)
         vpn.full_clean()
         vpn.save()
 
@@ -42,7 +42,7 @@ class VPNTestCase(TestCase):
             abo = OfferSubscription(offer=self.offer, member=self.member)
             abo.full_clean()
             abo.save()
-            vpn = VPNConfiguration(administrative_subscription=abo)
+            vpn = VPNConfiguration(offersubscription=abo)
             vpn.full_clean()
             vpn.save()
 
@@ -60,7 +60,7 @@ class VPNTestCase(TestCase):
         """If there is not endpoint, we consider it to be correct."""
         vpn = VPNConfiguration.objects.all()[0]
         if vpn.ipv4_endpoint is not None:
-            abo = vpn.administrative_subscription
+            abo = vpn.offersubscription
             subnet = abo.ip_subnet.get(ip_pool=self.v4_pool)
             self.assertIn(vpn.ipv4_endpoint, subnet.inet)
 
@@ -72,7 +72,7 @@ class VPNTestCase(TestCase):
         """If there is not endpoint, we consider it to be correct."""
         vpn = VPNConfiguration.objects.all()[0]
         if vpn.ipv6_endpoint is not None:
-            abo = vpn.administrative_subscription
+            abo = vpn.offersubscription
             subnet = abo.ip_subnet.get(ip_pool=self.v6_pool)
             self.assertIn(vpn.ipv6_endpoint, subnet.inet)
 
@@ -94,7 +94,7 @@ class VPNTestCase(TestCase):
 
     def test_automatic_login(self):
         vpn = VPNConfiguration.objects.all()[0]
-        expected_login = vpn.administrative_subscription.member.ldap_cn + "-vpn1"
+        expected_login = vpn.offersubscription.member.ldap_cn + "-vpn1"
         self.assertEqual(vpn.login, expected_login)
 
     def test_has_multiple_vpn(self):