def test_update_companion_record__linguistics_restrictions(self): old_name = names.generator.get_test_name(name='old') new_name = names.generator.get_test_name(name='new') companion_record = logic.create_companion_record( utg_name=old_name, description='old-description', type=relations.TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_1) with mock.patch('the_tale.linguistics.logic.sync_restriction' ) as sync_restriction: logic.update_companion_record( companion_record, utg_name=new_name, description='new-description', type=relations.TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_2) self.assertEqual(sync_restriction.call_args_list, [ mock.call(group=linguistics_relations.TEMPLATE_RESTRICTION_GROUP. COMPANION, external_id=companion_record.id, name=new_name.normal_form()) ])
def test_update_companion_record__linguistics_restrictions(self): old_name = names.generator.get_test_name(name='old') new_name = names.generator.get_test_name(name='new') companion_record = logic.create_companion_record(utg_name=old_name, description='old-description', type=relations.TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_1) with mock.patch('the_tale.linguistics.logic.sync_restriction') as sync_restriction: logic.update_companion_record(companion_record, utg_name=new_name, description='new-description', type=relations.TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_2) self.assertEqual(sync_restriction.call_args_list, [mock.call(group=linguistics_relations.TEMPLATE_RESTRICTION_GROUP.COMPANION, external_id=companion_record.id, name=new_name.normal_form())])
def test_update_companion_record__linguistics_restrictions(self): old_name = names.generator().get_test_name(name='old') new_name = names.generator().get_test_name(name='new') companion_record = logic.create_companion_record(utg_name=old_name, description='old-description', type=game_relations.BEING_TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_1, communication_verbal=game_relations.COMMUNICATION_VERBAL.random(), communication_gestures=game_relations.COMMUNICATION_GESTURES.random(), communication_telepathic=game_relations.COMMUNICATION_TELEPATHIC.random(), intellect_level=game_relations.INTELLECT_LEVEL.random()) with mock.patch('the_tale.linguistics.logic.sync_restriction') as sync_restriction: logic.update_companion_record(companion_record, utg_name=new_name, description='new-description', type=game_relations.BEING_TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_2, communication_verbal=game_relations.COMMUNICATION_VERBAL.random(), communication_gestures=game_relations.COMMUNICATION_GESTURES.random(), communication_telepathic=game_relations.COMMUNICATION_TELEPATHIC.random(), intellect_level=game_relations.INTELLECT_LEVEL.random()) self.assertEqual(sync_restriction.call_args_list, [mock.call(group=linguistics_relations.TEMPLATE_RESTRICTION_GROUP.COMPANION, external_id=companion_record.id, name=new_name.normal_form())])
def test_update_companion_record(self): old_name = names.generator.get_test_name(name='old') new_name = names.generator.get_test_name(name='new') type = relations.TYPE.random() dedication = relations.DEDICATION.random() archetype = game_relations.ARCHETYPE.random() mode = relations.MODE.random() max_health = 666 companion_record = logic.create_companion_record(utg_name=old_name, description='old-description', type=relations.TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_1) with self.check_increased(lambda: models.CompanionRecord.objects.get(id=companion_record.id).updated_at): with self.check_not_changed(lambda: models.CompanionRecord.objects.get(id=companion_record.id).created_at): with self.check_not_changed(models.CompanionRecord.objects.count): with self.check_changed(lambda: storage.companions._version): with self.check_not_changed(storage.companions.__len__): logic.update_companion_record(companion_record, utg_name=new_name, description='new-description', type=type, max_health=max_health, dedication=dedication, archetype=archetype, mode=mode, abilities=helpers.FAKE_ABILITIES_CONTAINER_2) self.assertEqual(companion_record.name, new_name.normal_form()) self.assertEqual(companion_record.description, 'new-description') self.assertEqual(companion_record.type, type) self.assertEqual(companion_record.dedication, dedication) self.assertEqual(companion_record.max_health, max_health) self.assertEqual(companion_record.mode, mode) self.assertEqual(companion_record.archetype, archetype) self.assertEqual(companion_record.abilities, helpers.FAKE_ABILITIES_CONTAINER_2) storage.companions.refresh() companion_record = storage.companions[companion_record.id] self.assertEqual(companion_record.name, new_name.normal_form()) self.assertEqual(companion_record.description, 'new-description') self.assertEqual(companion_record.type, type) self.assertEqual(companion_record.dedication, dedication) self.assertEqual(companion_record.max_health, max_health) self.assertEqual(companion_record.mode, mode) self.assertEqual(companion_record.archetype, archetype) self.assertEqual(companion_record.abilities, helpers.FAKE_ABILITIES_CONTAINER_2)
def test_update_companion_record__linguistics_restrictions(self): old_name = names.generator().get_test_name(name='old') new_name = names.generator().get_test_name(name='new') companion_record = logic.create_companion_record(utg_name=old_name, description='old-description', type=beings_relations.TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_1, communication_verbal=beings_relations.COMMUNICATION_VERBAL.random(), communication_gestures=beings_relations.COMMUNICATION_GESTURES.random(), communication_telepathic=beings_relations.COMMUNICATION_TELEPATHIC.random(), intellect_level=beings_relations.INTELLECT_LEVEL.random(), structure=beings_relations.STRUCTURE.random(), features=frozenset((beings_relations.FEATURE.random(), beings_relations.FEATURE.random())), movement=beings_relations.MOVEMENT.random(), body=beings_relations.BODY.random(), size=beings_relations.SIZE.random(), weapons=[artifacts_objects.Weapon(weapon=artifacts_relations.STANDARD_WEAPON.random(), material=tt_artifacts_relations.MATERIAL.random(), power_type=artifacts_relations.ARTIFACT_POWER_TYPE.random())]) with mock.patch('the_tale.linguistics.logic.sync_restriction') as sync_restriction: logic.update_companion_record(companion_record, utg_name=new_name, description='new-description', type=beings_relations.TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_2, communication_verbal=beings_relations.COMMUNICATION_VERBAL.random(), communication_gestures=beings_relations.COMMUNICATION_GESTURES.random(), communication_telepathic=beings_relations.COMMUNICATION_TELEPATHIC.random(), intellect_level=beings_relations.INTELLECT_LEVEL.random(), structure=beings_relations.STRUCTURE.random(), features=frozenset((beings_relations.FEATURE.random(), beings_relations.FEATURE.random())), movement=beings_relations.MOVEMENT.random(), body=beings_relations.BODY.random(), size=beings_relations.SIZE.random(), weapons=[artifacts_objects.Weapon(weapon=artifacts_relations.STANDARD_WEAPON.random(), material=tt_artifacts_relations.MATERIAL.random(), power_type=artifacts_relations.ARTIFACT_POWER_TYPE.random())]) self.assertEqual(sync_restriction.call_args_list, [mock.call(group=linguistics_relations.TEMPLATE_RESTRICTION_GROUP.COMPANION, external_id=companion_record.id, name=new_name.normal_form())])
def test_update_companion_record__linguistics_restrictions(self): old_name = names.generator().get_test_name(name='old') new_name = names.generator().get_test_name(name='new') companion_record = logic.create_companion_record( utg_name=old_name, description='old-description', type=game_relations.BEING_TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_1, communication_verbal=game_relations.COMMUNICATION_VERBAL.random(), communication_gestures=game_relations.COMMUNICATION_GESTURES. random(), communication_telepathic=game_relations.COMMUNICATION_TELEPATHIC. random(), intellect_level=game_relations.INTELLECT_LEVEL.random()) with mock.patch('the_tale.linguistics.logic.sync_restriction' ) as sync_restriction: logic.update_companion_record( companion_record, utg_name=new_name, description='new-description', type=game_relations.BEING_TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_2, communication_verbal=game_relations.COMMUNICATION_VERBAL. random(), communication_gestures=game_relations.COMMUNICATION_GESTURES. random(), communication_telepathic=game_relations. COMMUNICATION_TELEPATHIC.random(), intellect_level=game_relations.INTELLECT_LEVEL.random()) self.assertEqual(sync_restriction.call_args_list, [ mock.call(group=linguistics_relations.TEMPLATE_RESTRICTION_GROUP. COMPANION, external_id=companion_record.id, name=new_name.normal_form()) ])
def test_update_companion_record(self): old_name = names.generator().get_test_name(name='old') new_name = names.generator().get_test_name(name='new') type = beings_relations.TYPE.random() dedication = relations.DEDICATION.random() archetype = game_relations.ARCHETYPE.random() mode = relations.MODE.random() max_health = 666 communication_verbal = beings_relations.COMMUNICATION_VERBAL.random() communication_gestures = beings_relations.COMMUNICATION_GESTURES.random() communication_telepathic = beings_relations.COMMUNICATION_TELEPATHIC.random() intellect_level = beings_relations.INTELLECT_LEVEL.random() structure = beings_relations.STRUCTURE.random() features = frozenset((beings_relations.FEATURE.random(), beings_relations.FEATURE.random())) movement = beings_relations.MOVEMENT.random() body = beings_relations.BODY.random() size = beings_relations.SIZE.random() weapons = [artifacts_objects.Weapon(weapon=artifacts_relations.STANDARD_WEAPON.random(), material=tt_artifacts_relations.MATERIAL.random(), power_type=artifacts_relations.ARTIFACT_POWER_TYPE.random())] companion_record = logic.create_companion_record(utg_name=old_name, description='old-description', type=beings_relations.TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_1, communication_verbal=beings_relations.COMMUNICATION_VERBAL.random(), communication_gestures=beings_relations.COMMUNICATION_GESTURES.random(), communication_telepathic=beings_relations.COMMUNICATION_TELEPATHIC.random(), intellect_level=beings_relations.INTELLECT_LEVEL.random(), structure=beings_relations.STRUCTURE.random(), features=frozenset((beings_relations.FEATURE.random(), beings_relations.FEATURE.random())), movement=beings_relations.MOVEMENT.random(), body=beings_relations.BODY.random(), size=beings_relations.SIZE.random(), weapons=[artifacts_objects.Weapon(weapon=artifacts_relations.STANDARD_WEAPON.random(), material=tt_artifacts_relations.MATERIAL.random(), power_type=artifacts_relations.ARTIFACT_POWER_TYPE.random())]) with self.check_increased(lambda: models.CompanionRecord.objects.get(id=companion_record.id).updated_at): with self.check_not_changed(lambda: models.CompanionRecord.objects.get(id=companion_record.id).created_at): with self.check_not_changed(models.CompanionRecord.objects.count): with self.check_changed(lambda: storage.companions._version): with self.check_not_changed(storage.companions.__len__): logic.update_companion_record(companion_record, utg_name=new_name, description='new-description', type=type, max_health=max_health, dedication=dedication, archetype=archetype, mode=mode, abilities=helpers.FAKE_ABILITIES_CONTAINER_2, communication_verbal=communication_verbal, communication_gestures=communication_gestures, communication_telepathic=communication_telepathic, intellect_level=intellect_level, structure=structure, features=features, movement=movement, body=body, size=size, weapons=weapons) self.assertEqual(companion_record.name, new_name.normal_form()) self.assertEqual(companion_record.description, 'new-description') self.assertEqual(companion_record.type, type) self.assertEqual(companion_record.dedication, dedication) self.assertEqual(companion_record.max_health, max_health) self.assertEqual(companion_record.mode, mode) self.assertEqual(companion_record.archetype, archetype) self.assertEqual(companion_record.abilities, helpers.FAKE_ABILITIES_CONTAINER_2) self.assertEqual(companion_record.communication_verbal, communication_verbal) self.assertEqual(companion_record.communication_gestures, communication_gestures) self.assertEqual(companion_record.communication_telepathic, communication_telepathic) self.assertEqual(companion_record.intellect_level, intellect_level) self.assertEqual(companion_record.structure, structure) self.assertEqual(companion_record.features, features) self.assertEqual(companion_record.movement, movement) self.assertEqual(companion_record.body, body) self.assertEqual(companion_record.size, size) self.assertEqual(companion_record.weapons, weapons) storage.companions.refresh() companion_record = storage.companions[companion_record.id] self.assertEqual(companion_record.name, new_name.normal_form()) self.assertEqual(companion_record.description, 'new-description') self.assertEqual(companion_record.type, type) self.assertEqual(companion_record.dedication, dedication) self.assertEqual(companion_record.max_health, max_health) self.assertEqual(companion_record.mode, mode) self.assertEqual(companion_record.archetype, archetype) self.assertEqual(companion_record.abilities, helpers.FAKE_ABILITIES_CONTAINER_2) self.assertEqual(companion_record.communication_verbal, communication_verbal) self.assertEqual(companion_record.communication_gestures, communication_gestures) self.assertEqual(companion_record.communication_telepathic, communication_telepathic) self.assertEqual(companion_record.intellect_level, intellect_level) self.assertEqual(companion_record.structure, structure) self.assertEqual(companion_record.features, features) self.assertEqual(companion_record.movement, movement) self.assertEqual(companion_record.body, body) self.assertEqual(companion_record.size, size) self.assertEqual(companion_record.weapons, weapons)
def test_update_companion_record(self): old_name = names.generator.get_test_name(name="old") new_name = names.generator.get_test_name(name="new") type = game_relations.BEING_TYPE.random() dedication = relations.DEDICATION.random() archetype = game_relations.ARCHETYPE.random() mode = relations.MODE.random() max_health = 666 communication_verbal = game_relations.COMMUNICATION_VERBAL.random() communication_gestures = game_relations.COMMUNICATION_GESTURES.random() communication_telepathic = game_relations.COMMUNICATION_TELEPATHIC.random() intellect_level = game_relations.INTELLECT_LEVEL.random() companion_record = logic.create_companion_record( utg_name=old_name, description="old-description", type=game_relations.BEING_TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_1, communication_verbal=game_relations.COMMUNICATION_VERBAL.random(), communication_gestures=game_relations.COMMUNICATION_GESTURES.random(), communication_telepathic=game_relations.COMMUNICATION_TELEPATHIC.random(), intellect_level=game_relations.INTELLECT_LEVEL.random(), ) with self.check_increased(lambda: models.CompanionRecord.objects.get(id=companion_record.id).updated_at): with self.check_not_changed(lambda: models.CompanionRecord.objects.get(id=companion_record.id).created_at): with self.check_not_changed(models.CompanionRecord.objects.count): with self.check_changed(lambda: storage.companions._version): with self.check_not_changed(storage.companions.__len__): logic.update_companion_record( companion_record, utg_name=new_name, description="new-description", type=type, max_health=max_health, dedication=dedication, archetype=archetype, mode=mode, abilities=helpers.FAKE_ABILITIES_CONTAINER_2, communication_verbal=communication_verbal, communication_gestures=communication_gestures, communication_telepathic=communication_telepathic, intellect_level=intellect_level, ) self.assertEqual(companion_record.name, new_name.normal_form()) self.assertEqual(companion_record.description, "new-description") self.assertEqual(companion_record.type, type) self.assertEqual(companion_record.dedication, dedication) self.assertEqual(companion_record.max_health, max_health) self.assertEqual(companion_record.mode, mode) self.assertEqual(companion_record.archetype, archetype) self.assertEqual(companion_record.abilities, helpers.FAKE_ABILITIES_CONTAINER_2) self.assertEqual(companion_record.communication_verbal, communication_verbal) self.assertEqual(companion_record.communication_gestures, communication_gestures) self.assertEqual(companion_record.communication_telepathic, communication_telepathic) self.assertEqual(companion_record.intellect_level, intellect_level) storage.companions.refresh() companion_record = storage.companions[companion_record.id] self.assertEqual(companion_record.name, new_name.normal_form()) self.assertEqual(companion_record.description, "new-description") self.assertEqual(companion_record.type, type) self.assertEqual(companion_record.dedication, dedication) self.assertEqual(companion_record.max_health, max_health) self.assertEqual(companion_record.mode, mode) self.assertEqual(companion_record.archetype, archetype) self.assertEqual(companion_record.abilities, helpers.FAKE_ABILITIES_CONTAINER_2) self.assertEqual(companion_record.communication_verbal, communication_verbal) self.assertEqual(companion_record.communication_gestures, communication_gestures) self.assertEqual(companion_record.communication_telepathic, communication_telepathic) self.assertEqual(companion_record.intellect_level, intellect_level)
def test_update_companion_record(self): old_name = names.generator().get_test_name(name='old') new_name = names.generator().get_test_name(name='new') type = game_relations.BEING_TYPE.random() dedication = relations.DEDICATION.random() archetype = game_relations.ARCHETYPE.random() mode = relations.MODE.random() max_health = 666 communication_verbal = game_relations.COMMUNICATION_VERBAL.random() communication_gestures = game_relations.COMMUNICATION_GESTURES.random() communication_telepathic = game_relations.COMMUNICATION_TELEPATHIC.random( ) intellect_level = game_relations.INTELLECT_LEVEL.random() companion_record = logic.create_companion_record( utg_name=old_name, description='old-description', type=game_relations.BEING_TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_1, communication_verbal=game_relations.COMMUNICATION_VERBAL.random(), communication_gestures=game_relations.COMMUNICATION_GESTURES. random(), communication_telepathic=game_relations.COMMUNICATION_TELEPATHIC. random(), intellect_level=game_relations.INTELLECT_LEVEL.random()) with self.check_increased(lambda: models.CompanionRecord.objects.get( id=companion_record.id).updated_at): with self.check_not_changed( lambda: models.CompanionRecord.objects.get( id=companion_record.id).created_at): with self.check_not_changed( models.CompanionRecord.objects.count): with self.check_changed( lambda: storage.companions._version): with self.check_not_changed( storage.companions.__len__): logic.update_companion_record( companion_record, utg_name=new_name, description='new-description', type=type, max_health=max_health, dedication=dedication, archetype=archetype, mode=mode, abilities=helpers.FAKE_ABILITIES_CONTAINER_2, communication_verbal=communication_verbal, communication_gestures=communication_gestures, communication_telepathic= communication_telepathic, intellect_level=intellect_level) self.assertEqual(companion_record.name, new_name.normal_form()) self.assertEqual(companion_record.description, 'new-description') self.assertEqual(companion_record.type, type) self.assertEqual(companion_record.dedication, dedication) self.assertEqual(companion_record.max_health, max_health) self.assertEqual(companion_record.mode, mode) self.assertEqual(companion_record.archetype, archetype) self.assertEqual(companion_record.abilities, helpers.FAKE_ABILITIES_CONTAINER_2) self.assertEqual(companion_record.communication_verbal, communication_verbal) self.assertEqual(companion_record.communication_gestures, communication_gestures) self.assertEqual(companion_record.communication_telepathic, communication_telepathic) self.assertEqual(companion_record.intellect_level, intellect_level) storage.companions.refresh() companion_record = storage.companions[companion_record.id] self.assertEqual(companion_record.name, new_name.normal_form()) self.assertEqual(companion_record.description, 'new-description') self.assertEqual(companion_record.type, type) self.assertEqual(companion_record.dedication, dedication) self.assertEqual(companion_record.max_health, max_health) self.assertEqual(companion_record.mode, mode) self.assertEqual(companion_record.archetype, archetype) self.assertEqual(companion_record.abilities, helpers.FAKE_ABILITIES_CONTAINER_2) self.assertEqual(companion_record.communication_verbal, communication_verbal) self.assertEqual(companion_record.communication_gestures, communication_gestures) self.assertEqual(companion_record.communication_telepathic, communication_telepathic) self.assertEqual(companion_record.intellect_level, intellect_level)
def test_update_companion_record(self): old_name = names.generator.get_test_name(name='old') new_name = names.generator.get_test_name(name='new') type = relations.TYPE.random() dedication = relations.DEDICATION.random() archetype = game_relations.ARCHETYPE.random() mode = relations.MODE.random() max_health = 666 companion_record = logic.create_companion_record( utg_name=old_name, description='old-description', type=relations.TYPE.random(), max_health=10, dedication=relations.DEDICATION.random(), archetype=game_relations.ARCHETYPE.random(), mode=relations.MODE.random(), abilities=helpers.FAKE_ABILITIES_CONTAINER_1) with self.check_increased(lambda: models.CompanionRecord.objects.get( id=companion_record.id).updated_at): with self.check_not_changed( lambda: models.CompanionRecord.objects.get( id=companion_record.id).created_at): with self.check_not_changed( models.CompanionRecord.objects.count): with self.check_changed( lambda: storage.companions._version): with self.check_not_changed( storage.companions.__len__): logic.update_companion_record( companion_record, utg_name=new_name, description='new-description', type=type, max_health=max_health, dedication=dedication, archetype=archetype, mode=mode, abilities=helpers.FAKE_ABILITIES_CONTAINER_2) self.assertEqual(companion_record.name, new_name.normal_form()) self.assertEqual(companion_record.description, 'new-description') self.assertEqual(companion_record.type, type) self.assertEqual(companion_record.dedication, dedication) self.assertEqual(companion_record.max_health, max_health) self.assertEqual(companion_record.mode, mode) self.assertEqual(companion_record.archetype, archetype) self.assertEqual(companion_record.abilities, helpers.FAKE_ABILITIES_CONTAINER_2) storage.companions.refresh() companion_record = storage.companions[companion_record.id] self.assertEqual(companion_record.name, new_name.normal_form()) self.assertEqual(companion_record.description, 'new-description') self.assertEqual(companion_record.type, type) self.assertEqual(companion_record.dedication, dedication) self.assertEqual(companion_record.max_health, max_health) self.assertEqual(companion_record.mode, mode) self.assertEqual(companion_record.archetype, archetype) self.assertEqual(companion_record.abilities, helpers.FAKE_ABILITIES_CONTAINER_2)