Exemplo n.º 1
0
    def test_removing_unique_portal_adders(self):
        """
        Test that unique portal adder specificatin is removed from configuration
        after it has been used first time
        """
        portal_config = [PortalAdderConfiguration(icons = (1, 2),
                                                  level_type = 'catacombs',
                                                  location_type = 'room',
                                                  chance = 100,
                                                  new_level = 'upper crypt',
                                                  unique = True),
                         PortalAdderConfiguration(icons = (1, 2),
                                                  level_type = 'upper crypt',
                                                  location_type = 'room',
                                                  chance = 100,
                                                  new_level = 'lower crypt',
                                                  unique = False)
                                                 ]

        factory = PortalAdderFactory(portal_config,
                                     self.rng)
        factory.level_generator_factory = mock()

        portal_adders = factory.create_portal_adders('catacombs')

        assert_that(factory.config, has_length(1))
Exemplo n.º 2
0
    def test_removing_unique_portal_adders(self):
        """
        Test that unique portal adder specificatin is removed from configuration
        after it has been used first time
        """
        portal_config = [
            PortalAdderConfiguration(icons=(1, 2),
                                     level_type='catacombs',
                                     location_type='room',
                                     chance=100,
                                     new_level='upper crypt',
                                     unique=True),
            PortalAdderConfiguration(icons=(1, 2),
                                     level_type='upper crypt',
                                     location_type='room',
                                     chance=100,
                                     new_level='lower crypt',
                                     unique=False)
        ]

        factory = PortalAdderFactory(portal_config, self.rng)
        factory.level_generator_factory = mock()

        portal_adders = factory.create_portal_adders('catacombs')

        assert_that(factory.config, has_length(1))
Exemplo n.º 3
0
    def test_level_type_is_respected(self):
        """
        Test that portal adder factory respects level type
        """
        portal_config = [PortalAdderConfiguration(icons = (1, 2),
                                                  level_type = 'catacombs',
                                                  location_type = 'room',
                                                  chance = 100,
                                                  new_level = 'upper crypt',
                                                  unique = False),
                         PortalAdderConfiguration(icons = (1, 2),
                                                  level_type = 'upper crypt',
                                                  location_type = 'room',
                                                  chance = 100,
                                                  new_level = 'lower crypt',
                                                  unique = False)
                                                 ]

        factory = PortalAdderFactory(portal_config,
                                     self.rng)
        factory.level_generator_factory = mock()

        portal_adders = factory.create_portal_adders('catacombs')

        assert_that(portal_adders, has_length(1))
Exemplo n.º 4
0
    def test_level_type_is_respected(self):
        """
        Test that portal adder factory respects level type
        """
        portal_config = [
            PortalAdderConfiguration(icons=(1, 2),
                                     level_type='catacombs',
                                     location_type='room',
                                     chance=100,
                                     new_level='upper crypt',
                                     unique=False),
            PortalAdderConfiguration(icons=(1, 2),
                                     level_type='upper crypt',
                                     location_type='room',
                                     chance=100,
                                     new_level='lower crypt',
                                     unique=False)
        ]

        factory = PortalAdderFactory(portal_config, self.rng)
        factory.level_generator_factory = mock()

        portal_adders = factory.create_portal_adders('catacombs')

        assert_that(portal_adders, has_length(1))