def setUp(self): factories.TechLevelFactory(name="2K") factories.SkillFactory(name="Handguns", tech_level__name="2K") if sys.version_info >= (3,): self.stream_type = StringIO else: self.stream_type = BytesIO
def test_specialized_minimum_level(self): """ Current data in sheet has specialization skills in the following format, which the cost for the 0 level as 0. It should be changed to None (null) in the future, to underline that the skill cannot be purchased at that level. """ skill = factories.SkillFactory(name="Sword", skill_cost_0=0, skill_cost_1=2, is_specialization=True) self.assertEqual(skill.get_minimum_level(), 1)
def test_export_unicode(self): unicode_word = u'βαλλίζω' factories.SkillFactory(name="Ballet dancing", description=u"This is ballet dancing, from the " u"greek root of '{uword}' (to " u"dance, to jump about).".format( uword=unicode_word )) data = marshal.csv_export(sheet.models.Skill) if sys.version_info < (3,): data = data.decode('utf-8') self.assertTrue(data.startswith('Skill'), msg="The data should start with the table name") self.assertIn(unicode_word, data)
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.tech_level = factories.TechLevelFactory(name='2K') self.pistol = factories.SkillFactory(name="Pistol")
def test_add_new_skill_with_required_skills(self): det_url = reverse("import") response = self.client.post(det_url, { 'import_data' : ("Skill\n" "name,tech_level,description,notes,can_be_defaulted," "is_specialization,skill_cost_0,skill_cost_1,skill_cost_2," "skill_cost_3,type,stat,required_edges,required_skills\n" "Throw,all,,,TRUE,TRUE,0,2,,,Combat,MOV,,Unarmed combat"), }) self.assertRedirects(response, reverse("import")) response = self.client.get(reverse("browse", args=["Skill"])) self.assertContains(response, "Unarmed combat") hdr = response.context['header'] name_index = hdr.index("name") required_skills_index = hdr.index("required skills") for rr in response.context['rows']: if rr[name_index] == "Throw": self.assertEqual(rr[required_skills_index], "Unarmed combat") break # Missing a skill should be an error. response = self.client.post(det_url, { 'import_data' : ("Skill\n" "name,tech_level,description,notes,can_be_defaulted," "is_specialization,skill_cost_0,skill_cost_1,skill_cost_2," "skill_cost_3,type,stat,required_edges,required_skills\n" "Surgical strike,all,,,TRUE,TRUE,0,2,,,Combat,MOV,," "Unarmed combat|Surgery"), }) self.assertContains(response, "Requirement `Surgery") factories.SkillFactory(name="Surgery") response = self.client.post(det_url, { 'import_data' : ("Skill\n" "name,tech_level,description,notes,can_be_defaulted," "is_specialization,skill_cost_0,skill_cost_1,skill_cost_2," "skill_cost_3,type,stat,required_edges,required_skills\n" "Surgical strike,all,,,TRUE,TRUE,0,2,,,Combat,MOV,," "Unarmed combat|Surgery"), }) self.assertRedirects(response, reverse("import")) sk = Skill.objects.get(name="Surgical strike") self.assertTrue(sk.required_skills.filter(name="Unarmed combat" ).exists()) self.assertTrue(sk.required_skills.filter(name="Surgery").exists()) # Try it again. response = self.client.post(det_url, { 'import_data' : ("Skill\n" "name,tech_level,description,notes,can_be_defaulted," "is_specialization,skill_cost_0,skill_cost_1,skill_cost_2," "skill_cost_3,type,stat,required_edges,required_skills\n" "Surgical strike,all,,,TRUE,TRUE,0,2,,,Combat,MOV,," "Unarmed combat | Surgery"), }) self.assertRedirects(response, reverse("import"))
def setUp(self): factories.SkillFactory(name="Handguns", tech_level__name="2K")
def setUp(self): self.admin = factories.UserFactory(username='******') self.assertTrue(self.client.login(username="******", password="******")) factories.SkillFactory(name="Unarmed combat") factories.BaseFirearmFactory(name="Glock 19")