Exemplo n.º 1
0
    def test_creation(self):
        Setting.objects.all().delete()
        settings.refresh()

        settings_number = Setting.objects.all().count()
        time = TimePrototype.get_current_time()
        self.assertEqual(time.turn_number, 0)
        self.assertEqual(Setting.objects.all().count(), settings_number + 1)
        time = TimePrototype.get_current_time()
        self.assertEqual(time.turn_number, 0)
        self.assertEqual(Setting.objects.all().count(), settings_number + 1)
Exemplo n.º 2
0
    def test_creation(self):
        Setting.objects.all().delete()
        settings.refresh()

        settings_number = Setting.objects.all().count()
        time = TimePrototype.get_current_time()
        self.assertEqual(time.turn_number, 0)
        self.assertEqual(Setting.objects.all().count(), settings_number+1)
        time = TimePrototype.get_current_time()
        self.assertEqual(time.turn_number, 0)
        self.assertEqual(Setting.objects.all().count(), settings_number+1)
Exemplo n.º 3
0
    def test_creation(self):
        Setting.objects.all().delete()
        settings.refresh()

        settings_number = Setting.objects.all().count()

        self.assertEqual(turn.number(), 0)
        self.assertEqual(Setting.objects.all().count(), settings_number)

        turn.increment()

        self.assertEqual(turn.number(), 1)
        self.assertEqual(Setting.objects.all().count(), settings_number + 1)
Exemplo n.º 4
0
def setUp(self):
    from the_tale.accounts import tt_api as accounts_tt_api

    from the_tale.accounts.achievements.storage import achievements_storage
    from the_tale.collections.storage import collections_storage, kits_storage, items_storage
    from the_tale.linguistics.storage import game_dictionary, game_lexicon, restrictions_storage

    from the_tale.game.prototypes import GameState
    from the_tale.game.persons import storage as persons_storage
    from the_tale.game.mobs import storage as mobs_storage
    from the_tale.game.companions import storage as companions_storage
    from the_tale.game.artifacts import storage as artifacts_storage
    from the_tale.game.heroes import storage as heroes_storage
    from the_tale.game.map.storage import map_info_storage
    from the_tale.game.places import storage as places_storage
    from the_tale.game.roads.storage import roads_storage, waymarks_storage

    accounts_tt_api.debug_clear_service()

    settings.refresh(force=True)

    heroes_storage.position_descriptions.clear()

    places_storage.places.clear()
    places_storage.buildings.clear()
    persons_storage.persons.clear()
    persons_storage.social_connections.clear()
    waymarks_storage.clear()
    roads_storage.clear()
    mobs_storage.mobs.clear()
    companions_storage.companions.clear()
    artifacts_storage.artifacts.clear()
    map_info_storage.clear()
    places_storage.resource_exchanges.clear()
    collections_storage.clear()
    kits_storage.clear()
    items_storage.clear()
    achievements_storage.clear()
    game_dictionary.clear()
    game_lexicon.clear()
    restrictions_storage.clear()

    GameState.start()

    from the_tale.blogs import conf as blogs_conf
    from the_tale.blogs import models as blogs_models

    for tag_id in blogs_conf.settings.DEFAULT_TAGS:
        blogs_models.Tag.objects.create(id=tag_id,
                                        name='{}'.format(tag_id),
                                        description='{}'.format(tag_id))
Exemplo n.º 5
0
def setUp(self):
    from the_tale.accounts.achievements.storage import achievements_storage
    from the_tale.collections.storage import collections_storage, kits_storage, items_storage
    from the_tale.linguistics.storage import game_dictionary, game_lexicon, restrictions_storage

    from the_tale.game.prototypes import GameState
    from the_tale.game.persons import storage as persons_storage
    from the_tale.game.mobs.storage import mobs_storage
    from the_tale.game.companions import storage as companions_storage
    from the_tale.game.artifacts.storage import artifacts_storage
    from the_tale.game.heroes import storage as heroes_storage
    from the_tale.game.map.storage import map_info_storage
    from the_tale.game.places import storage as places_storage
    from the_tale.game.roads.storage import roads_storage, waymarks_storage

    settings.refresh(force=True)

    heroes_storage.position_descriptions.clear()

    places_storage.places.clear()
    places_storage.buildings.clear()
    persons_storage.persons.clear()
    persons_storage.social_connections.clear()
    waymarks_storage.clear()
    roads_storage.clear()
    mobs_storage.clear()
    companions_storage.companions.clear()
    artifacts_storage.clear()
    map_info_storage.clear()
    places_storage.resource_exchanges.clear()
    collections_storage.clear()
    kits_storage.clear()
    items_storage.clear()
    achievements_storage.clear()
    game_dictionary.clear()
    game_lexicon.clear()
    restrictions_storage.clear()

    GameState.start()

    from the_tale.blogs import conf as blogs_conf
    from the_tale.blogs import models as blogs_models

    for tag_id in blogs_conf.settings.DEFAULT_TAGS:
        blogs_models.Tag.objects.create(id=tag_id, name='{}'.format(tag_id), description='{}'.format(tag_id))
Exemplo n.º 6
0
    def run(self):
        while not self.exception_raised and not self.stop_required:
            try:
                db.reset_queries()

                cmd = self.command_queue.get(block=True, timeout=self.GET_CMD_TIMEOUT)

                if self.REFRESH_SETTINGS:
                    settings.refresh()
                self.process_cmd(cmd.payload)
            except queue.Empty:
                if self.REFRESH_SETTINGS:
                    settings.refresh()
                self.process_no_cmd()
                if self.NO_CMD_TIMEOUT:
                    time.sleep(self.NO_CMD_TIMEOUT)

        self.on_stop()

        self.logger.info('loop stopped')
Exemplo n.º 7
0
def setUp(self):
    from the_tale.accounts.achievements.storage import achievements_storage
    from the_tale.collections.storage import collections_storage, kits_storage, items_storage
    from the_tale.linguistics.storage import game_dictionary, game_lexicon, restrictions_storage

    from the_tale.game.prototypes import GameState
    from the_tale.game.persons import storage as persons_storage
    from the_tale.game.mobs.storage import mobs_storage
    from the_tale.game.companions import storage as companions_storage
    from the_tale.game.artifacts.storage import artifacts_storage
    from the_tale.game.heroes import storage as heroes_storage
    from the_tale.game.map.storage import map_info_storage
    from the_tale.game.map.places.storage import places_storage, buildings_storage, resource_exchange_storage
    from the_tale.game.map.roads.storage import roads_storage, waymarks_storage

    settings.refresh(force=True)

    heroes_storage.position_descriptions.clear()

    places_storage.clear()
    buildings_storage.clear()
    persons_storage.persons_storage.clear()
    persons_storage.social_connections.clear()
    waymarks_storage.clear()
    roads_storage.clear()
    mobs_storage.clear()
    companions_storage.companions.clear()
    artifacts_storage.clear()
    map_info_storage.clear()
    resource_exchange_storage.clear()
    collections_storage.clear()
    kits_storage.clear()
    items_storage.clear()
    achievements_storage.clear()
    game_dictionary.clear()
    game_lexicon.clear()
    restrictions_storage.clear()

    GameState.start()
Exemplo n.º 8
0
def setUp(self):
    from the_tale.accounts.achievements.storage import achievements_storage
    from the_tale.collections.storage import collections_storage, kits_storage, items_storage
    from the_tale.linguistics.storage import game_dictionary, game_lexicon, restrictions_storage

    from the_tale.game.prototypes import GameState
    from the_tale.game.persons import storage as persons_storage
    from the_tale.game.mobs.storage import mobs_storage
    from the_tale.game.companions import storage as companions_storage
    from the_tale.game.artifacts.storage import artifacts_storage
    from the_tale.game.heroes import storage as heroes_storage
    from the_tale.game.map.storage import map_info_storage
    from the_tale.game.map.places.storage import places_storage, buildings_storage, resource_exchange_storage
    from the_tale.game.map.roads.storage import roads_storage, waymarks_storage

    settings.refresh(force=True)

    heroes_storage.position_descriptions.clear()

    places_storage.clear()
    buildings_storage.clear()
    persons_storage.persons_storage.clear()
    persons_storage.social_connections.clear()
    waymarks_storage.clear()
    roads_storage.clear()
    mobs_storage.clear()
    companions_storage.companions.clear()
    artifacts_storage.clear()
    map_info_storage.clear()
    resource_exchange_storage.clear()
    collections_storage.clear()
    kits_storage.clear()
    items_storage.clear()
    achievements_storage.clear()
    game_dictionary.clear()
    game_lexicon.clear()
    restrictions_storage.clear()

    GameState.start()
Exemplo n.º 9
0
 def setUp(self):
     super(GameStateTests, self).setUp()
     Setting.objects.all().delete()
     settings.refresh()
Exemplo n.º 10
0
    def __call__(self, request):
        settings.refresh()

        return self.get_response(request)
Exemplo n.º 11
0
 def setUp(self):
     super(GameStateTests, self).setUp()
     Setting.objects.all().delete()
     settings.refresh()