예제 #1
0
    def __init__(self, rcfile=None):
        """
        Initialize the mock by using the MPD port specified in:
        rcfile -- Configuration file containing mpd.port (default: __TESTS_DIR__/conf/main.test.conf)
        """
        super(MpdServerMock, self).__init__()

        if rcfile is None:
            rcfile = Armando.get_tests_dir() \
                     + os.sep + 'conf' \
                     + os.sep + 'main.test.conf'

        self.__config = Config(rcfile)
        if self.__config.get('mpd.port') is not None:
            self.__port = int(self.__config.get('mpd.port'))
        else:
            raise AttributeError('The configuration file %s has no mpd.port setting' % rcfile)

        self.__state = 'stop'