@@ -89,6 +89,35 @@ def test_publicly_hidden_publish_by_default(self):
89
89
self .assertEqual (qs .first (), self .canteen_published_armee )
90
90
91
91
92
+ class TestCanteenSatelliteQuerySet (TestCase ):
93
+ @classmethod
94
+ def setUpTestData (cls ):
95
+ cls .canteen_central_1 = CanteenFactory (
96
+ siret = "75665621899905" , production_type = Canteen .ProductionType .CENTRAL , satellite_canteens_count = 2
97
+ ) # 1 missing
98
+ cls .canteen_central_2 = CanteenFactory (
99
+ siret = "75665621899906" , production_type = Canteen .ProductionType .CENTRAL , satellite_canteens_count = 2
100
+ )
101
+ cls .canteen_on_site_central_1 = CanteenFactory (
102
+ production_type = Canteen .ProductionType .ON_SITE_CENTRAL , central_producer_siret = cls .canteen_central_1 .siret
103
+ )
104
+ cls .canteen_on_site_central_2 = CanteenFactory (
105
+ production_type = Canteen .ProductionType .ON_SITE_CENTRAL , central_producer_siret = cls .canteen_central_2 .siret
106
+ )
107
+ cls .canteen_on_site_central_2 = CanteenFactory (
108
+ production_type = Canteen .ProductionType .ON_SITE_CENTRAL , central_producer_siret = cls .canteen_central_2 .siret
109
+ )
110
+
111
+ def test_is_satellite (self ):
112
+ self .assertEqual (Canteen .objects .count (), 5 )
113
+ self .assertEqual (Canteen .objects .is_satellite ().count (), 3 )
114
+
115
+ def test_get_satellites (self ):
116
+ self .assertEqual (Canteen .objects .count (), 5 )
117
+ self .assertEqual (Canteen .objects .get_satellites (self .canteen_central_1 .siret ).count (), 1 )
118
+ self .assertEqual (Canteen .objects .get_satellites (self .canteen_central_2 .siret ).count (), 2 )
119
+
120
+
92
121
class TestCanteenSiretOrSirenUniteLegaleQuerySet (TestCase ):
93
122
@classmethod
94
123
def setUpTestData (cls ):
0 commit comments