def test_calculate_racial_breakdown_lowrolls(self, mockrand):
     self.redis.lpush('npc_race','gnome')
     city = City(self.redis)
     mockrand.randint.side_effect = [11, 1, 2, 3, 4, 5, 6, 7, 8, 9]
     mockredis = Mock(self.redis)
     mockredis.lrange = MagicMock(return_value=['orc', 'ogre', 'molekin'])
     city.redis = mockredis
     city.calculate_racial_breakdown()
     self.assertLess(0, len(city.races))
     self.assertDictEqual({'molekin': 3, 'other': 94, 'orc': 1, 'ogre': 2}, city.races)
 def test_calculate_racial_breakdown(self, mockrand):
     """  """
     self.redis.lpush('npc_race','gnome')
     city = City(self.redis)
     mockrand.randint.side_effect = [11, 30, 30, 30, 30]
     mockredis = Mock(self.redis)
     mockredis.lrange = MagicMock(return_value=['orc', 'ogre', 'molekin', 'human', 'harpy', 'halfling', 'elf'
                                                'goblin', 'gnome', 'dwarf', 'coatikin', 'bugbear', 'catfolk'])
     city.redis = mockredis
     city.calculate_racial_breakdown()
     self.assertLess(0, len(city.races))
     self.assertDictEqual({'molekin': 29, 'other': 11, 'orc': 30, 'ogre': 30}, city.races)
Esempio n. 3
0
 def test_calculate_racial_breakdown_lowrolls(self, mockrand):
     self.redis.lpush('npc_race', 'gnome')
     city = City(self.redis)
     mockrand.randint.side_effect = [11, 1, 2, 3, 4, 5, 6, 7, 8, 9]
     mockredis = Mock(self.redis)
     mockredis.lrange = MagicMock(return_value=['orc', 'ogre', 'molekin'])
     city.redis = mockredis
     city.calculate_racial_breakdown()
     self.assertLess(0, len(city.races))
     self.assertDictEqual({
         'molekin': 3,
         'other': 94,
         'orc': 1,
         'ogre': 2
     }, city.races)
Esempio n. 4
0
 def test_calculate_racial_breakdown(self, mockrand):
     """  """
     self.redis.lpush('npc_race', 'gnome')
     city = City(self.redis)
     mockrand.randint.side_effect = [11, 30, 30, 30, 30]
     mockredis = Mock(self.redis)
     mockredis.lrange = MagicMock(return_value=[
         'orc', 'ogre', 'molekin', 'human', 'harpy', 'halfling', 'elf'
         'goblin', 'gnome', 'dwarf', 'coatikin', 'bugbear', 'catfolk'
     ])
     city.redis = mockredis
     city.calculate_racial_breakdown()
     self.assertLess(0, len(city.races))
     self.assertDictEqual(
         {
             'molekin': 29,
             'other': 11,
             'orc': 30,
             'ogre': 30
         }, city.races)