Ejemplo n.º 1
0
    def setUp(self):
        super(PersonPowerTest, self).setUp()
        linguistics_logic.sync_static_restrictions()

        self.place_1, self.place_2, self.place_3 = create_test_map()

        self.person = self.place_1.persons[0]
Ejemplo n.º 2
0
    def setUp(self):
        super(LinguisticsDateTests, self).setUp()

        linguistics_logic.sync_static_restrictions()

        self.date = turn.LinguisticsDate(
            tt_calendar.Date(year=1, month=2, day=3))
Ejemplo n.º 3
0
    def handle(self, *args, **options):

        linguistics_logic.sync_static_restrictions()

        self.create_map()

        run_django_command(['map_update_map'])
Ejemplo n.º 4
0
    def handle(self, *args, **options):

        linguistics_logic.sync_static_restrictions()

        self.create_map()

        run_django_command(['map_update_map'])
Ejemplo n.º 5
0
    def setUp(self):
        super(PersonPowerTest, self).setUp()
        linguistics_logic.sync_static_restrictions()

        self.place_1, self.place_2, self.place_3 = create_test_map()

        self.person = self.place_1.persons[0]
Ejemplo n.º 6
0
    def setUp(self):
        super(GameTimeTests, self).setUp()

        linguistics_logic.sync_static_restrictions()

        self.time = prototypes.GameTime(year=1,
                                        month=2,
                                        day=3,
                                        hour=4,
                                        minute=5,
                                        second=6)
Ejemplo n.º 7
0
def create_test_map():
    linguistics_logic.sync_static_restrictions()

    politic_power_storage.places.reset()
    politic_power_storage.persons.reset()

    tt_api_impacts.debug_clear_service()

    map_logic.create_test_map_info()

    p1 = places_logic.create_place(x=1, y=1, size=1, utg_name=names.generator().get_test_name(name='1x1'), race=relations.RACE.HUMAN)
    p2 = places_logic.create_place(x=3, y=3, size=3, utg_name=names.generator().get_test_name(name='10x10'), race=relations.RACE.HUMAN)
    p3 = places_logic.create_place(x=1, y=3, size=3, utg_name=names.generator().get_test_name(name='1x10'), race=relations.RACE.HUMAN)

    for place in places_storage.places.all():
        for i in range(3):
            persons_logic.create_person(place=place,
                                        race=relations.RACE.random(),
                                        gender=relations.GENDER.random(),
                                        type=persons_relations.PERSON_TYPE.random(),
                                        utg_name=names.generator().get_test_name())

    for place in places_storage.places.all():
        place.refresh_attributes()

    RoadPrototype.create(point_1=p1, point_2=p2).update()
    RoadPrototype.create(point_1=p2, point_2=p3).update()

    update_waymarks()

    nearest_cells.update_nearest_cells()

    mob_1 = mobs_logic.create_random_mob_record('mob_1')
    mob_2 = mobs_logic.create_random_mob_record('mob_2')
    mob_3 = mobs_logic.create_random_mob_record('mob_3')

    artifacts_logic.create_random_artifact_record('loot_1', mob=mob_1)
    artifacts_logic.create_random_artifact_record('loot_2', mob=mob_2)
    artifacts_logic.create_random_artifact_record('loot_3', mob=mob_3)

    artifacts_logic.create_random_artifact_record('helmet_1', type=artifacts_relations.ARTIFACT_TYPE.HELMET, mob=mob_1)
    artifacts_logic.create_random_artifact_record('plate_1', type=artifacts_relations.ARTIFACT_TYPE.PLATE, mob=mob_2)
    artifacts_logic.create_random_artifact_record('boots_1', type=artifacts_relations.ARTIFACT_TYPE.BOOTS, mob=mob_3)

    for equipment_slot in heroes_relations.EQUIPMENT_SLOT.records:
        if equipment_slot.default:
            artifacts_logic.create_random_artifact_record(equipment_slot.default, type=equipment_slot.artifact_type)

    companions_logic.create_random_companion_record('companion_1', dedication=companions_relations.DEDICATION.HEROIC, state=companions_relations.STATE.ENABLED)
    companions_logic.create_random_companion_record('companion_2', dedication=companions_relations.DEDICATION.BOLD, state=companions_relations.STATE.ENABLED)
    companions_logic.create_random_companion_record('companion_3', dedication=companions_relations.DEDICATION.BOLD, state=companions_relations.STATE.DISABLED)

    return p1, p2, p3
Ejemplo n.º 8
0
    def setUp(self):
        super(PlacePowerTest, self).setUp()
        linguistics_logic.sync_static_restrictions()

        map_logic.create_test_map_info()

        storage.places.clear()
        persons_storage.persons.clear()

        self.place = logic.create_place(
            x=0, y=0, size=5, utg_name=names.generator.get_test_name(name="power_test_place"), race=RACE.HUMAN
        )

        for i in xrange(3):
            logic.add_person_to_place(self.place)

        persons_storage.persons.sync(force=True)
Ejemplo n.º 9
0
    def setUp(self):
        super(PlacePowerTest, self).setUp()
        linguistics_logic.sync_static_restrictions()

        map_logic.create_test_my_info()

        places_storage.clear()
        persons_storage.clear()

        self.place = PlacePrototype.create(x=0,
                                           y=0,
                                           size=5,
                                           utg_name=names.generator.get_test_name(name='power_test_place'),
                                           race=RACE.HUMAN)

        self.place.sync_persons(force_add=True)

        persons_storage.sync(force=True)
Ejemplo n.º 10
0
    def test_sync_static_restrictions(self):
        for restrictions_group in relations.TEMPLATE_RESTRICTION_GROUP.records:

            if restrictions_group.static_relation is None:
                continue

            for record in restrictions_group.static_relation.records:
                self.assertEqual(storage.restrictions_storage.get_restriction(restrictions_group, record.value), None)


        logic.sync_static_restrictions()

        for restrictions_group in relations.TEMPLATE_RESTRICTION_GROUP.records:

            if restrictions_group.static_relation is None:
                continue

            for record in restrictions_group.static_relation.records:
                self.assertNotEqual(storage.restrictions_storage.get_restriction(restrictions_group, record.value), None)
Ejemplo n.º 11
0
    def setUp(self):
        super(PlacePowerTest, self).setUp()
        linguistics_logic.sync_static_restrictions()

        map_logic.create_test_my_info()

        places_storage.clear()
        persons_storage.clear()

        self.place = PlacePrototype.create(
            x=0,
            y=0,
            size=5,
            utg_name=names.generator.get_test_name(name='power_test_place'),
            race=RACE.HUMAN)

        self.place.sync_persons(force_add=True)

        persons_storage.sync(force=True)
Ejemplo n.º 12
0
    def setUp(self):
        super(PlacePowerTest, self).setUp()
        linguistics_logic.sync_static_restrictions()

        map_logic.create_test_map_info()

        storage.places.clear()
        persons_storage.persons.clear()

        self.place = logic.create_place(x=0,
                                        y=0,
                                        size=5,
                                        utg_name=names.generator().get_test_name(name='power_test_place'),
                                        race=RACE.HUMAN)

        for i in range(3):
            logic.add_person_to_place(self.place)

        persons_storage.persons.sync(force=True)
Ejemplo n.º 13
0
def create_test_map():
    linguistics_logic.sync_static_restrictions()

    map_logic.create_test_my_info()

    p1 = PlacePrototype.create( x=1, y=1, size=1, utg_name=names.generator.get_test_name(name='1x1'))
    p2 = PlacePrototype.create( x=3, y=3, size=3, utg_name=names.generator.get_test_name(name='10x10'))
    p3 = PlacePrototype.create( x=1, y=3, size=3, utg_name=names.generator.get_test_name(name='1x10'))

    for place in places_storage.all():
        place.sync_persons(force_add=True)

    RoadPrototype.create(point_1=p1, point_2=p2).update()
    RoadPrototype.create(point_1=p2, point_2=p3).update()

    update_waymarks()

    update_nearest_cells()

    mob_1 = MobRecordPrototype.create_random('mob_1')
    mob_2 = MobRecordPrototype.create_random('mob_2')
    mob_3 = MobRecordPrototype.create_random('mob_3')

    ArtifactRecordPrototype.create_random('loot_1', mob=mob_1)
    ArtifactRecordPrototype.create_random('loot_2', mob=mob_2)
    ArtifactRecordPrototype.create_random('loot_3', mob=mob_3)

    ArtifactRecordPrototype.create_random('helmet_1', type_=ARTIFACT_TYPE.HELMET, mob=mob_1)
    ArtifactRecordPrototype.create_random('plate_1', type_=ARTIFACT_TYPE.PLATE, mob=mob_2)
    ArtifactRecordPrototype.create_random('boots_1', type_=ARTIFACT_TYPE.BOOTS, mob=mob_3)

    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.PANTS, type_=ARTIFACT_TYPE.PANTS)
    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.BOOTS, type_=ARTIFACT_TYPE.BOOTS)
    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.PLATE, type_=ARTIFACT_TYPE.PLATE)
    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.GLOVES, type_=ARTIFACT_TYPE.GLOVES)
    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.WEAPON, type_=ARTIFACT_TYPE.MAIN_HAND)

    companions_logic.create_random_companion_record('companion_1', dedication=companions_relations.DEDICATION.HEROIC, state=companions_relations.STATE.ENABLED)
    companions_logic.create_random_companion_record('companion_2', dedication=companions_relations.DEDICATION.BOLD, state=companions_relations.STATE.ENABLED)
    companions_logic.create_random_companion_record('companion_3', dedication=companions_relations.DEDICATION.BOLD, state=companions_relations.STATE.DISABLED)

    return p1, p2, p3
Ejemplo n.º 14
0
def create_test_map():
    linguistics_logic.sync_static_restrictions()

    map_logic.create_test_map_info()

    p1 = places_logic.create_place( x=1, y=1, size=1, utg_name=names.generator().get_test_name(name='1x1'), race=relations.RACE.HUMAN)
    p2 = places_logic.create_place( x=3, y=3, size=3, utg_name=names.generator().get_test_name(name='10x10'), race=relations.RACE.HUMAN)
    p3 = places_logic.create_place( x=1, y=3, size=3, utg_name=names.generator().get_test_name(name='1x10'), race=relations.RACE.HUMAN)

    for place in places_storage.places.all():
        for i in range(3):
            places_logic.add_person_to_place(place)

    RoadPrototype.create(point_1=p1, point_2=p2).update()
    RoadPrototype.create(point_1=p2, point_2=p3).update()

    update_waymarks()

    nearest_cells.update_nearest_cells()

    mob_1 = MobRecordPrototype.create_random('mob_1')
    mob_2 = MobRecordPrototype.create_random('mob_2')
    mob_3 = MobRecordPrototype.create_random('mob_3')

    ArtifactRecordPrototype.create_random('loot_1', mob=mob_1)
    ArtifactRecordPrototype.create_random('loot_2', mob=mob_2)
    ArtifactRecordPrototype.create_random('loot_3', mob=mob_3)

    ArtifactRecordPrototype.create_random('helmet_1', type_=ARTIFACT_TYPE.HELMET, mob=mob_1)
    ArtifactRecordPrototype.create_random('plate_1', type_=ARTIFACT_TYPE.PLATE, mob=mob_2)
    ArtifactRecordPrototype.create_random('boots_1', type_=ARTIFACT_TYPE.BOOTS, mob=mob_3)

    for equipment_slot in heroes_relations.EQUIPMENT_SLOT.records:
        if equipment_slot.default:
            ArtifactRecordPrototype.create_random(equipment_slot.default, type_=equipment_slot.artifact_type)

    companions_logic.create_random_companion_record('companion_1', dedication=companions_relations.DEDICATION.HEROIC, state=companions_relations.STATE.ENABLED)
    companions_logic.create_random_companion_record('companion_2', dedication=companions_relations.DEDICATION.BOLD, state=companions_relations.STATE.ENABLED)
    companions_logic.create_random_companion_record('companion_3', dedication=companions_relations.DEDICATION.BOLD, state=companions_relations.STATE.DISABLED)

    return p1, p2, p3
Ejemplo n.º 15
0
def create_test_map():
    linguistics_logic.sync_static_restrictions()

    map_logic.create_test_map_info()

    p1 = places_logic.create_place( x=1, y=1, size=1, utg_name=names.generator().get_test_name(name='1x1'), race=relations.RACE.HUMAN)
    p2 = places_logic.create_place( x=3, y=3, size=3, utg_name=names.generator().get_test_name(name='10x10'), race=relations.RACE.HUMAN)
    p3 = places_logic.create_place( x=1, y=3, size=3, utg_name=names.generator().get_test_name(name='1x10'), race=relations.RACE.HUMAN)

    for place in places_storage.places.all():
        for i in range(3):
            places_logic.add_person_to_place(place)

    RoadPrototype.create(point_1=p1, point_2=p2).update()
    RoadPrototype.create(point_1=p2, point_2=p3).update()

    update_waymarks()

    nearest_cells.update_nearest_cells()

    mob_1 = MobRecordPrototype.create_random('mob_1')
    mob_2 = MobRecordPrototype.create_random('mob_2')
    mob_3 = MobRecordPrototype.create_random('mob_3')

    ArtifactRecordPrototype.create_random('loot_1', mob=mob_1)
    ArtifactRecordPrototype.create_random('loot_2', mob=mob_2)
    ArtifactRecordPrototype.create_random('loot_3', mob=mob_3)

    ArtifactRecordPrototype.create_random('helmet_1', type_=ARTIFACT_TYPE.HELMET, mob=mob_1)
    ArtifactRecordPrototype.create_random('plate_1', type_=ARTIFACT_TYPE.PLATE, mob=mob_2)
    ArtifactRecordPrototype.create_random('boots_1', type_=ARTIFACT_TYPE.BOOTS, mob=mob_3)

    for equipment_slot in heroes_relations.EQUIPMENT_SLOT.records:
        if equipment_slot.default:
            ArtifactRecordPrototype.create_random(equipment_slot.default, type_=equipment_slot.artifact_type)

    companions_logic.create_random_companion_record('companion_1', dedication=companions_relations.DEDICATION.HEROIC, state=companions_relations.STATE.ENABLED)
    companions_logic.create_random_companion_record('companion_2', dedication=companions_relations.DEDICATION.BOLD, state=companions_relations.STATE.ENABLED)
    companions_logic.create_random_companion_record('companion_3', dedication=companions_relations.DEDICATION.BOLD, state=companions_relations.STATE.DISABLED)

    return p1, p2, p3
Ejemplo n.º 16
0
def create_test_map():
    linguistics_logic.sync_static_restrictions()

    map_logic.create_test_my_info()

    p1 = PlacePrototype.create(
        x=1, y=1, size=1, utg_name=names.generator.get_test_name(name='1x1'))
    p2 = PlacePrototype.create(
        x=3, y=3, size=3, utg_name=names.generator.get_test_name(name='10x10'))
    p3 = PlacePrototype.create(
        x=1, y=3, size=3, utg_name=names.generator.get_test_name(name='1x10'))

    for place in places_storage.all():
        place.sync_persons(force_add=True)

    RoadPrototype.create(point_1=p1, point_2=p2).update()
    RoadPrototype.create(point_1=p2, point_2=p3).update()

    update_waymarks()

    update_nearest_cells()

    mob_1 = MobRecordPrototype.create_random('mob_1')
    mob_2 = MobRecordPrototype.create_random('mob_2')
    mob_3 = MobRecordPrototype.create_random('mob_3')

    ArtifactRecordPrototype.create_random('loot_1', mob=mob_1)
    ArtifactRecordPrototype.create_random('loot_2', mob=mob_2)
    ArtifactRecordPrototype.create_random('loot_3', mob=mob_3)

    ArtifactRecordPrototype.create_random('helmet_1',
                                          type_=ARTIFACT_TYPE.HELMET,
                                          mob=mob_1)
    ArtifactRecordPrototype.create_random('plate_1',
                                          type_=ARTIFACT_TYPE.PLATE,
                                          mob=mob_2)
    ArtifactRecordPrototype.create_random('boots_1',
                                          type_=ARTIFACT_TYPE.BOOTS,
                                          mob=mob_3)

    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.PANTS,
                                          type_=ARTIFACT_TYPE.PANTS)
    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.BOOTS,
                                          type_=ARTIFACT_TYPE.BOOTS)
    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.PLATE,
                                          type_=ARTIFACT_TYPE.PLATE)
    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.GLOVES,
                                          type_=ARTIFACT_TYPE.GLOVES)
    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.WEAPON,
                                          type_=ARTIFACT_TYPE.MAIN_HAND)

    companions_logic.create_random_companion_record(
        'companion_1',
        dedication=companions_relations.DEDICATION.HEROIC,
        state=companions_relations.STATE.ENABLED)
    companions_logic.create_random_companion_record(
        'companion_2',
        dedication=companions_relations.DEDICATION.BOLD,
        state=companions_relations.STATE.ENABLED)
    companions_logic.create_random_companion_record(
        'companion_3',
        dedication=companions_relations.DEDICATION.BOLD,
        state=companions_relations.STATE.DISABLED)

    return p1, p2, p3
Ejemplo n.º 17
0
 def setUp(self):
     super(JobTest, self).setUp()
     linguistics_logic.sync_static_restrictions()
     self.job = FakeJob.create(normal_power=1000)
Ejemplo n.º 18
0
    def handle(self, *args, **options):

        print
        print 'UPDATE MAP'
        print

        run_django_command(['map_update_map'])

        print
        print 'UPDATE LINGUISTICS'

        linguistics_logic.sync_static_restrictions()
        linguistics_logic.update_templates_errors()
        linguistics_logic.update_words_usage_info()

        print
        print 'SYNC MARKET'
        run_django_command(['market_sync_goods'])

        print
        print 'SYNC SOCIAL CONNECTIONS'

        persons_logic.sync_social_connections()

        print
        print 'SYNC ACTUAL BILLS'

        bills_logic.update_actual_bills_for_all_accounts()

        print
        print 'REMOVE OLD SDN INFO'

        if portal_settings.SETTINGS_CDN_INFO_KEY in settings:
            del settings[portal_settings.SETTINGS_CDN_INFO_KEY]

        if portal_settings.SETTINGS_PREV_CDN_SYNC_TIME_KEY in settings:
            del settings[portal_settings.SETTINGS_PREV_CDN_SYNC_TIME_KEY]

        print
        print 'SYNC GROUPS AND PERMISSIONS'
        print

        sync_group('content group', ['cms.add_page', 'cms.change_page', 'cms.delete_page',
                                    'news.add_news', 'news.change_news', 'news.delete_news'])

        sync_group(forum_settings.MODERATOR_GROUP_NAME, ['forum.moderate_thread', 'forum.moderate_post'])

        sync_group('bills moderators group', ['bills.moderate_bill'])

        sync_group('developers group', ['mobs.moderate_mobrecord',
                                        'artifacts.moderate_artifactrecord',
                                        'linguistics.moderate_word',
                                        'linguistics.moderate_template',
                                        'linguistics.edit_template'])

        sync_group('folclor moderation group', ['blogs.moderate_post'])

        sync_group('mobs & artifacts create group', ['mobs.create_mobrecord', 'artifacts.create_artifactrecord'])

        sync_group('accounts moderators group', ['accounts.moderate_account'])

        sync_group('collections editors group', ['collections.edit_collection',
                                                 'collections.edit_kit',
                                                 'collections.edit_item'])
        sync_group('collections moderators group', ['collections.moderate_collection',
                                                    'collections.moderate_kit',
                                                    'collections.moderate_item'])

        sync_group('achievements editors group', ['achievements.edit_achievement'])


        sync_group(linguistics_settings.MODERATOR_GROUP_NAME, ['linguistics.moderate_word',
                                                               'linguistics.moderate_template',
                                                               'linguistics.edit_template'])
        sync_group(linguistics_settings.EDITOR_GROUP_NAME, ['linguistics.moderate_word',
                                                            'linguistics.edit_template'])
Ejemplo n.º 19
0
    def handle(self, *args, **options):

        print()
        print('UPDATE MAP')
        print()

        run_django_command(['map_update_map'])

        print()
        print('UPDATE LINGUISTICS')

        linguistics_logic.sync_static_restrictions()
        linguistics_logic.update_templates_errors()
        linguistics_logic.update_words_usage_info()

        print()
        print('SYNC ACTUAL BILLS')

        bills_logic.update_actual_bills_for_all_accounts()

        print()
        print('REFRESH ATTRIBUTES')

        places_logic.refresh_all_places_attributes()
        persons_logic.refresh_all_persons_attributes()

        print()
        print('REMOVE OLD CDN INFO')

        if portal_settings.SETTINGS_CDN_INFO_KEY in settings:
            del settings[portal_settings.SETTINGS_CDN_INFO_KEY]

        if portal_settings.SETTINGS_PREV_CDN_SYNC_TIME_KEY in settings:
            del settings[portal_settings.SETTINGS_PREV_CDN_SYNC_TIME_KEY]

        print()
        print('SYNC GROUPS AND PERMISSIONS')
        print()

        sync_group('content group',
                   ['news.add_news', 'news.change_news', 'news.delete_news'])

        sync_group(forum_settings.MODERATOR_GROUP_NAME,
                   ['forum.moderate_thread', 'forum.moderate_post'])

        sync_group('bills moderators group', ['bills.moderate_bill'])

        sync_group('developers group', [
            'mobs.moderate_mobrecord', 'artifacts.moderate_artifactrecord',
            'linguistics.moderate_word', 'linguistics.moderate_template',
            'linguistics.edit_template'
        ])

        sync_group('folclor moderation group', ['blogs.moderate_post'])

        sync_group(
            'mobs & artifacts create group',
            ['mobs.create_mobrecord', 'artifacts.create_artifactrecord'])

        sync_group('accounts moderators group', ['accounts.moderate_account'])

        sync_group('clans moderators group', ['clans.moderate_clan'])

        sync_group('collections editors group', [
            'collections.edit_collection', 'collections.edit_kit',
            'collections.edit_item'
        ])
        sync_group('collections moderators group', [
            'collections.moderate_collection', 'collections.moderate_kit',
            'collections.moderate_item'
        ])

        sync_group('achievements editors group',
                   ['achievements.edit_achievement'])

        sync_group(linguistics_settings.MODERATOR_GROUP_NAME, [
            'linguistics.moderate_word', 'linguistics.moderate_template',
            'linguistics.edit_template'
        ])
        sync_group(linguistics_settings.EDITOR_GROUP_NAME,
                   ['linguistics.moderate_word', 'linguistics.edit_template'])
Ejemplo n.º 20
0
 def setUp(self):
     super(JobTest, self).setUp()
     linguistics_logic.sync_static_restrictions()
     self.job = logic.create_job(FakeJob)