old_contents: #!/usr/bin/env python2.7
  from __future__ import absolute_import, division, unicode_literals
  
  import json
  import requests
  import websocket
  
  test_url ='http://localhost:3000/so/cool'
  
  def validate_data(connections, expected_result):
      for connection in connections:
          print 'receiving {}'.format(connection)
          result = connection.recv()
          parsed_result = json.loads(result)
  
          assert parsed_result == expected_result, 'Input data: {} is different from output data: {}'.format(
              expected_result, parsed_result)
  
      print 'All 10 clients received {} successfully!'.format(expected_result)
  
  
  def main():
      # Make sure the value is null initially
      requests.put(test_url, json.dumps(None))
  
      connections = []
      for i in range(10):
          connection = websocket.create_connection("ws://localhost:3000/so/cool")
          connections.append(connection)
  
      validate_data(connections, None)
  
      # Put some data into icepeak over HTTP
      new_data = {'status': 'freezing'}
      requests.put(test_url, json.dumps(new_data))
  
      # Make sure all clients get the new data
      validate_data(connections, new_data)
  
      for connection in connections:
          connection.send_close()
          # connection.close()
  
      # Reset the value to make the test idempotent
      requests.put(test_url, json.dumps(None))
  
  if __name__ == '__main__':
      main()
  
new_contents: #!/usr/bin/env python3.7
  """
  This test creates 10 websocket connections, then PUTs some new data, and then tests that all 10 clients
  received the same data.
  """
  
  import asyncio
  import json
  import requests
  import sys
  import websockets
  
  test_url = 'http://localhost:3000/so/cool'
  
  
  async def validate_data(connections, expected_result):
      for connection in connections:
          # print('receiving {}'.format(connection))
          result = await connection.recv()
          parsed_result = json.loads(result)
  
          assert parsed_result == expected_result, 'Input data: {} is different from output data: {}'.format(
              expected_result, parsed_result)
  
      print('All 10 clients received {} successfully!'.format(expected_result))
  
  
  async def main():
      # Make sure the value is null initially
      requests.put(test_url, json.dumps(None))
  
      connections = []
      for _ in range(10):
          connection = await websockets.connect("ws://localhost:3000/so/cool")
          connections.append(connection)
  
      await validate_data(connections, None)
  
      # Put some data into icepeak over HTTP
      new_data = {'status': 'freezing'}
      requests.put(test_url, json.dumps(new_data))
  
      # Make sure all clients get the new data
      await validate_data(connections, new_data)
  
      for connection in connections:
          await connection.close()
  
      # Reset the value to make the test idempotent
      requests.put(test_url, json.dumps(None))
  
  
  if __name__ == '__main__':
      asyncio.get_event_loop().run_until_complete(main())
  
subject: Update multiple_clients_test.py to use Python 3.7