예제 #1
0
    def test_load_mixed_quest_definitions(self):
        '''Tests loading a QuestSet with quests defined as strings and as classes.'''
        quest_set_source = '''
from phonyep.aquest import AQuest
from eosclubhouse.libquest import Registry, QuestSet

class TestQuestSet(QuestSet):
    __pathway_name__ = 'web'
    __character_id__ = 'phony'
    __quests__ = [AQuest, 'ZQuest']

Registry.register_quest_set(TestQuestSet)
'''
        quest_source_template = '''
from eosclubhouse.libquest import Quest
class {}(Quest):
    pass
'''

        with tempfile.TemporaryDirectory() as tmpdir:
            episode_name = 'phonyep'
            dir_name = os.path.join(tmpdir, episode_name)
            os.mkdir(dir_name)

            quest_names = ['AQuest', 'ZQuest']
            for name in quest_names:
                with open(os.path.join(dir_name,
                                       name.lower() + '.py'),
                          'w') as quest_set_file:
                    quest_set_file.write(quest_source_template.format(name))

            # Set the quests for the QuestSet, the first is given as a string, the second as a
            # symbol.
            with open(os.path.join(dir_name, 'testquestset.py'),
                      'w') as quest_set_file:
                quest_set_file.write(quest_set_source)

            Registry._reset()
            Registry._loaded_episode = episode_name
            Registry.load(dir_name)
            self.assertIn('TestQuestSet', [
                quest_set.get_id() for quest_set in Registry.get_quest_sets()
            ])
예제 #2
0
#
# Copyright © 2020 Endless OS Foundation LLC.
#
# This file is part of clubhouse
# (see https://github.com/endlessm/clubhouse).
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
from eosclubhouse.libquest import QuestSet, Registry


class MakerPathWay(QuestSet):

    __pathway_name__ = 'Maker'
    __character_id__ = 'faber'


Registry.register_quest_set(MakerPathWay)
예제 #3
0
#
# Copyright © 2020 Endless OS Foundation LLC.
#
# This file is part of clubhouse
# (see https://github.com/endlessm/clubhouse).
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
from eosclubhouse.libquest import QuestSet, Registry


class ArtPathWay(QuestSet):

    __pathway_name__ = 'Art'
    __character_id__ = 'estelle'


Registry.register_quest_set(ArtPathWay)
예제 #4
0
#
# Copyright © 2020 Endless OS Foundation LLC.
#
# This file is part of clubhouse
# (see https://github.com/endlessm/clubhouse).
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
from eosclubhouse.libquest import QuestSet, Registry


class OSPathWay(QuestSet):

    __pathway_name__ = 'Operating System'
    __character_id__ = 'saniel'


Registry.register_quest_set(OSPathWay)
예제 #5
0
#
# Copyright © 2020 Endless OS Foundation LLC.
#
# This file is part of clubhouse
# (see https://github.com/endlessm/clubhouse).
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
from eosclubhouse.libquest import QuestSet, Registry


class WebPathWay(QuestSet):

    __pathway_name__ = 'Web'
    __character_id__ = 'riley'


Registry.register_quest_set(WebPathWay)
예제 #6
0
#
# Copyright © 2020 Endless OS Foundation LLC.
#
# This file is part of clubhouse
# (see https://github.com/endlessm/clubhouse).
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
from eosclubhouse.libquest import QuestSet, Registry


class GamesPathWay(QuestSet):

    __pathway_name__ = 'Games'
    __character_id__ = 'ada'


Registry.register_quest_set(GamesPathWay)