Пример #1
0
 def test_invalid_configuration(self):
     c = ConfigFile()
     c._readConfigFile(StringIO(self.exampleConfigTwo))
     self.assertFalse(c.isValid(), "This configuration should be invalid")
Пример #2
0
    def time(self):
        return self.__time

if __name__ == '__main__':
    log = logging.getLogger(__name__)
    logging.basicConfig(level=logging.DEBUG,
                        format='%(asctime)s %(levelname)-8s %(message)s',
                        datefmt='%a, %d %b %Y %H:%M:%S',
                        filename="/var/log/whashose.log")
    chatlog.SetupLog()

    
    log.info("Starting up Whashose...")
    
    cfloc = os.path.dirname(os.path.realpath(__file__)) + "/../whashose.config"
    cf = ConfigFile(cfloc)
    
    if not cf.isValid():
        log.error("Invalid configuration file.")
        exit(1)
    
    wac = WhatsAppConnector(cf.phonenumber, cf.password)
    wac.connect()
    
    queue = queue.Queue()
    mh = MessageHandler(queue)

    # Initialisation of the handlers we think are interesting 
    EchoHandler(mh)
    VrijmiboHandler(mh)
    TettenHandler(mh)
Пример #3
0
 def test_valid_configuration(self):
     c = ConfigFile()
     c._readConfigFile(StringIO(self.exampleConfigOne))
     self.assertTrue(c.isValid(), "This configuration should be valid")