Ejemplo n.º 1
0
 def _generate_result_dicts(self,
                            params,
                            data_spec,
                            access_zone_conditions,
                            res_limits,
                            item_number_limit,
                            access_zone,
                            client_id=None):
     opt_limit = 0
     opt_limit_vals = params.get('opt.limit')
     if opt_limit_vals:
         opt_limit = opt_limit_vals[0]
     if 0 < opt_limit < self.max_num_of_events:
         num_of_events = opt_limit
     elif 0 < item_number_limit < self.max_num_of_events:
         num_of_events = item_number_limit
     else:
         num_of_events = self.max_num_of_events
     return RandomEvent.generate_multiple_event_data(
         num_of_events,
         settings=self.settings,
         access_zone=access_zone,
         client_id=client_id,
         params=params)
Ejemplo n.º 2
0
 def test_generate_multiple_event_data(self, num):
     """Test RandomEvent.generate_multiple_event_data() method."""
     with standard_config_patch:
         events = list(RandomEvent.generate_multiple_event_data(num))
     self.assertEqual(len(events), num)