Exemplo n.º 1
0
class TestMember(unittest.TestCase):
    def setUp(self):
        self.mark_rae = Member('Mark', 'Rae', 33, "male", True, True)
        self.sarah_burns = Member('Sarah', 'Burns', 28, "female", False, True)
        self.chris_rettie = Member('Chris', 'Rettie', 35, "male", True, True)
        self.jill_rettie = Member('jill', 'Rettie', 36, "female", False, True)

    def test_member_instance_variables(self):
        self.assertEqual('Sarah', self.sarah_burns.first_name)
        self.assertEqual('Burns', self.sarah_burns.last_name)
        self.assertEqual(28, self.sarah_burns.age)
        self.assertEqual('female', self.sarah_burns.sex)
        self.assertEqual(False, self.sarah_burns.turbo_membership)
        self.assertEqual(True, self.sarah_burns.active)

    def test_member_full_name(self):
        self.assertEqual("Mark Rae", self.mark_rae.full_name(self.mark_rae))

    # def test_create_member(self):
    # unsure if i require this as the form should be feeding the controller with the user input
    # then the member repository will feed the database.

    def test_activate_turbo_membership(self):
        self.assertEqual(True, self.sarah_burns.activate_turbo_membership())

    def test_deactivate_turbo_membership(self):
        self.assertEqual(False, self.sarah_burns.deactivate_turbo_membership())

    def test_deactivate_membership(self):
        self.assertEqual(False, self.chris_rettie.deactivate_membership())

    def test_reactivate_membership(self):
        self.jill_rettie.deactivate_membership()
        self.assertEqual(True, self.jill_rettie.reactivate_membership())
class TestMember(unittest.TestCase):
    def setUp(self):
        self.member = Member("Kurt", "Steffan", "1973-05-27", 1)

    def test_member_created(self):
        self.assertEqual("Kurt", self.member.first_name)

    def test_member_full_name(self):
        self.assertEqual(
            "Kurt Steffan",
            self.member.full_name(self.member.first_name,
                                  self.member.last_name))
Exemplo n.º 3
0
class TestMember(unittest.TestCase):
    def setUp(self):
        self.member_1 = Member("Dario", "Cologna", "male", 34)

    # Name tests
    def test_member_has_first_name(self):
        self.assertEqual("Dario", self.member_1.first_name)

    def test_member_has_last_name(self):
        self.assertEqual("Cologna", self.member_1.last_name)

    def test_full_name__returns_first_and_last_name(self):
        self.assertEqual("Dario Cologna", self.member_1.full_name())

    # Gender attribute test
    def test_member_has_gender(self):
        self.assertEqual("male", self.member_1.gender)

    # Age tests
    def test_member_has_age(self):
        self.assertEqual(34, self.member_1.age)

    def test_increment_age__returns_age_plus_one(self):
        self.assertEqual(35, self.member_1.increment_age())