@@ -22,7 +22,7 @@ def teardown_module(module):
2222 # database here. But for tests this is probably not necessary.
2323
2424
25- class TestWizardScheduleSlots :
25+ class BaseForOtherWizardsTests :
2626
2727 def init_pycamp (self ):
2828 self .pycamp = Pycamp .create (
@@ -31,6 +31,8 @@ def init_pycamp(self):
3131 end = datetime (2024 ,6 ,24 ),
3232 )
3333
34+
35+ class TestWizardScheduleSlots (BaseForOtherWizardsTests ):
3436 @use_test_database
3537 def test_correct_number_of_slots_in_one_day (self ):
3638 p = Pycamp .create (
@@ -95,14 +97,7 @@ def test_no_slot_after_last_day_lunch(self):
9597 assert start >= lunch_time_end
9698
9799
98- class TestDefineWizardsSchedule :
99-
100- def init_pycamp (self ):
101- self .pycamp = Pycamp .create (
102- headquarters = "Narnia" ,
103- init = datetime (2024 ,6 ,20 ),
104- end = datetime (2024 ,6 ,24 ),
105- )
100+ class TestDefineWizardsSchedule (BaseForOtherWizardsTests ):
106101
107102 # If no wizards, returns {}
108103 @use_test_database
@@ -164,3 +159,41 @@ def test_all_slots_are_signed_a_wizard(self):
164159 assert all (
165160 (isinstance (s , Pycampista ) and s .wizard ) for s in sched .values ()
166161 )
162+
163+ class TestListWizards (BaseForOtherWizardsTests ):
164+
165+ @use_test_database
166+ def test_wizard_registration (self ):
167+ self .init_pycamp ()
168+ w = self .pycamp .add_wizard ("Gandalf" , 123 )
169+ wizards = self .pycamp .get_wizards ()
170+ assert len (wizards ) == 1
171+ assert w .username == wizards [0 ].username
172+
173+
174+ @use_test_database
175+ def test_wizard_registration_works_in_one_pycamp_only (self ):
176+ self .init_pycamp ()
177+ self .pycamp .add_wizard ("Gandalf" , 123 )
178+
179+ other_pycamp = Pycamp .create (
180+ headquarters = "Mordor" ,
181+ init = datetime (2025 ,3 ,22 ),
182+ end = datetime (2025 ,3 ,24 ),
183+ )
184+ w = other_pycamp .add_wizard ("Merlin" , 456 )
185+ #import ipdb; ipdb.set_trace()
186+ results = other_pycamp .get_wizards ()
187+ assert len (results ) == 1
188+ assert w .username == results [0 ].username
189+
190+
191+ # @use_test_database
192+ # def test_no_active_pycamp_then_fail(self):
193+ # self.init_pycamp()
194+ # agregarle un mago
195+
196+ # creo OTRO Pycamp
197+ # agregarle otro mago
198+
199+ # pedir listado: check está el OTRO mago solamente
0 commit comments