Пример #1
0
def create_event(event_type):
    """ Takes one event_type, gets a model to fill it with, gets a user, then returns an event.
    
    Accepts a tuple of event_type, then a dictionary of key information (see resource_configs)
    """
    # fetch the config for this event
    event_config = fetch_config_dictionary(event_type)
    model_instance = get_model_for_event(event_config)
    # Again, a very slow method and only suitable for this testing environment.
    user = User.objects.order_by('?')[0]

    return register_event(model_instance, event_type, given_user=user)
Пример #2
0
    def setUp(self):
        self.challenge = corefactories.ChallengeFactory(title="Blow bubbles")
        self.user = "******"
        self.event_type = "test-template"

        self.event = processors.register_event(self.event_type, self.user, self.challenge)