def setUp(self): factories.SheetFactory(character__name="Martel", character__campaign__name="FRP") factories.SheetFactory(character__name="Yukaghir", character__campaign__name="FRP") factories.SheetFactory(character__name="Asa", character__campaign__name="MR") self.admin = factories.UserFactory(username='******') self.assertTrue(self.client.login(username='******', password='******'))
def test_copy_sheet_choices_exclude_private_sheets(self): private_sheet = factories.SheetFactory( character__name="Johnny Mnemonic", character__owner=self.original_owner, character__private=True) form = sheet.forms.CopySheetForm(request=self._get_request()) sheet_ids = [pair[0] for pair in form.fields['sheet'].choices] self.assertNotIn(private_sheet.id, sheet_ids)
def test_copy_fails_if_target_exists(self): factories.SheetFactory(character__name="Jane Doe") form = sheet.forms.CopySheetForm(request=self._post_request(), data={ 'sheet': self.original_sheet.pk, 'to_name': 'Jane Doe' }) self.assertFalse(form.is_valid()) self.assertIn("already exists", '/'.join(form.errors['to_name']))
def setUp(self): self.request_factory = django.test.RequestFactory() self.admin = factories.UserFactory(username="******") self.original_owner = factories.UserFactory(username="******") self.original_sheet = factories.SheetFactory( character__name="John Doe", character__campaign__name="3K", character__owner=self.original_owner, armor=factories.ArmorFactory(base__name="Hard Leather"), helm=factories.HelmFactory(base__name="Leather hood"), weapons=[ factories.WeaponFactory(base__name="Short sword"), factories.WeaponFactory(base__name="Baton") ], ranged_weapons=[ factories.RangedWeaponFactory(base__name="Short bow"), factories.RangedWeaponFactory(base__name="Javelin") ], firearms=[ factories.FirearmFactory(base__name="M29 (OICW)", ammo__label='5.56Nto', ammo__bullet_type='FMJ'), factories.FirearmFactory(base__name="RK95", ammo__label='5.56Nto', ammo__bullet_type='FMJ') ], transient_effects=[ factories.TransientEffectFactory(name="Bless of templars"), factories.TransientEffectFactory(name="Courage of ancients") ], character__skills=[("Shooting", 3), ("Heckling", 2), ("Drunken boxing", 4)], character__edges=[("Toughness", 3), ("Athletic ability", 2), ("Bad eyesight", 4)]) self.original_character = self.original_sheet.character factories.SheetMiscellaneousItemFactory(item__name="Geiger counter", sheet=self.original_sheet) factories.SheetMiscellaneousItemFactory(item__name="Bandolier", sheet=self.original_sheet)
def setUp(self): self.request_factory = django.test.RequestFactory() self.admin = factories.UserFactory(username="******") self.assertTrue(self.client.login(username="******", password="******")) self.sheet = factories.SheetFactory() factories.SkillFactory(name="Acting / Bluff")
def setUp(self): self.admin = factories.UserFactory(username="******") factories.SheetFactory(character__name="Foo") self.middle_sheet = factories.SheetFactory(character__name="Bar") factories.SheetFactory(character__name="Qux") self.assertTrue(self.client.login(username="******", password="******"))