'Test that api_key ends up in the xqueue payload'

def test_matlab_api_key(self):

    elt = etree.fromstring(self.xml)
    system = test_capa_system()
    system.matlab_api_key = 'test_api_key'
    the_input = lookup_tag('matlabinput')(system, elt, {})
    data = {'submission': 'x    =    1234;'}
    response = the_input.handle_ajax('plot', data)
    body = system.xqueue['interface'].send_to_queue.call_args[1]['body']
    payload = json.loads(body)
    self.assertEqual('test_api_key', payload['token'])
    self.assertEqual('2', payload['endpoint_version'])
