def test_processInputBuffer(self):
     server = Server(1, 'temp.txt', True)
     server.inputBuffer = 'sgfdhg{fdghghgd}{fgfdgf}fgfsd'
     server.processInputBuffer()
     self.assertEqual(server.inputBuffer, '{fgfdgf}fgfsd')
     server.processInputBuffer()
     self.assertEqual(server.inputBuffer, 'fgfsd')        
def Main(progName, args):
    testServer = '--test-server' in args or '-t' in args
    
    print testServer

    if testServer:        
        os.unlink(DATA_FILE_NAME)
        server = Server(SERVER_PORT, DATA_FILE_NAME)
        
    test = RemoteTempServerTest()
    
    if testServer:
        server.start()
    
    test.runTests()
    time.sleep(0.25)

    if testServer:
        server.stopServer()
        return test.verifyOutput()
    
    return 0
from temp_server.TemperatureServer import Server


s = Server(8888, 'temps.csv', log=True)
print 'Starting server...'
s.startServer()
print 'Press enter to stop server'
raw_input()
print 'Stopping server'
s.stopServer()