def setUp(self):
        self.big_boss = Gangster('Big Boss', 21)

        self.g1 = Gangster('Gangster', 20)
        self.g2 = Gangster('Gangster 2', 20, 'Location 2')

        self.mog = MafiaOrganization(self.big_boss)
        self.mog.add_under(self.big_boss, self.g1)
        self.mog.add_under(self.g1, self.g2)
    def setUp(self):
        # Given
        self.big_boss = Gangster('Big Boss', 21, 'Location Big Boss')
        self.g1 = Gangster('Gangster', 20, 'Location Gangster')
        self.g2 = Gangster('Gangster 2', 20, 'Location Gangster 2')

        self.mog = MafiaOrganization(self.big_boss)
        self.mog.add_under(self.big_boss, self.g1)
        self.mog.add_under(self.g1, self.g2)

        # When
        self.mog.kill_member('Gangster')
    def test_find_by_name_search_for_gangster_no_matter_its_level_in_organization(self):
        g3 = Gangster('Subordinate Level 3-1', 18)
        g4 = Gangster('Subordinate Level 3-2', 18)

        g2 = Gangster('Subordinate Level 2', 19)
        g2.add_subordinate(g4)
        g2.add_subordinate(g3)

        g1 = Gangster('Big Boss Subordinate Level 1', 20)
        g1.add_subordinate(g2)

        self.big_boss.add_subordinate(g1)

        self.assertEquals(self.mog.find_by_name('Subordinate Level 3-2'), g4)
    def setUp(self):
        # Given
        self.big_boss = Gangster('Big Boss', 21)
        self.g1 = Gangster('Gangster', 20, 'Location Gangster')
        self.g2 = Gangster('Gangster 2', 30, 'Location Gangster 2')
        self.g3 = Gangster('Gangster 3', 32, 'Location Gangster 3')

        self.mog = MafiaOrganization(self.big_boss)
        self.mog.add_under(self.big_boss, self.g1)
        self.mog.add_under(self.g1, self.g2)
        self.mog.add_under(self.g1, self.g3)

        # When
        self.mog.send_member_to_jail('Gangster')
    def setUp(self):
        # Given
        self.big_boss = Gangster('Big Boss', 21, 'Location Big Boss')
        self.g1 = Gangster('Gangster', 31, 'Location Gangster')
        self.g2 = Gangster('Gangster 2', 32, 'Location Gangster 2')
        self.g3 = Gangster('Gangster 3', 33, 'Location Gangster 3')

        self.g4 = Gangster('Gangster 4', 12, 'Location Gangster 4')
        self.g5 = Gangster('Gangster 5', 12, 'Location Gangster 5')
        self.g6 = Gangster('Gangster 6', 12, 'Location Gangster 6')

        self.mog = MafiaOrganization(self.big_boss)
        self.mog.add_under(self.big_boss, self.g1)
        self.mog.add_under(self.big_boss, self.g2)
        self.mog.add_under(self.big_boss, self.g3)

        self.mog.add_under(self.g1, self.g4)
        self.mog.add_under(self.g2, self.g5)
        self.mog.add_under(self.g3, self.g6)

        # When
        self.mog.send_member_to_jail('Gangster')
 def setUp(self):
     self.big_boss = Gangster('Big Boss', 21)
     self.mog = MafiaOrganization(self.big_boss)
    def test_add_under_accepts_only_organization_members_as_boss(self):
        g2 = Gangster('Subordinate Level 2', 19)

        self.assertRaises(Exception, self.mog.add_under, self.g1, g2)
    def setUp(self):
        self.big_boss = Gangster('Big Boss', 21)
        self.g1 = Gangster('Big Boss Subordinate Level 1', 20)
        self.g2 = Gangster('Big Boss Subordinate Level 2', 21)

        self.mog = MafiaOrganization(self.big_boss)
    def test_find_by_name_search_for_big_boss_subordinate(self):
        g1 = Gangster('Big Boss Subordinate Level 1', 19)
        self.big_boss.add_subordinate(g1)

        self.assertEquals(self.mog.find_by_name('Big Boss Subordinate Level 1'), g1)
Exemple #10
0
 def test_has_boss_on_newly_created_gangster_return_false(self):
     g = Gangster('Gang', 12)
     self.assertFalse(g.has_boss())
    def test_set_big_boss_sets_correct_big_boss(self):
        big_boss2 = Gangster('Big Boss 2', 22)
        self.mog.set_big_boss(big_boss2)

        self.assertEquals(self.mog.get_big_boss(), big_boss2)
Exemple #12
0
    def setUp(self):
        self.g = Gangster('Gangster', 15)
        self.gb = Gangster('Gangster  Boss', 75)

        self.g.set_boss(self.gb)
Exemple #13
0
 def test_delete_subordinate_when_delete_unknown_gangster_returns_false(
         self):
     ngs = Gangster('Not Subordinate', 43)
     self.assertFalse(self.g.delete_subordinate(ngs))
Exemple #14
0
 def setUp(self):
     self.g = Gangster('some gangster', 12)
Exemple #15
0
    def setUp(self):
        self.g = Gangster('Gangster', 44)

        self.gs = Gangster('Subordinate', 43)
        self.g.add_subordinate(self.gs)
Exemple #16
0
 def test_constructor_sets_correct_location(self):
     g = Gangster('name', 45, 'my location')
     self.assertEquals(g.location, 'my location')