'Wait until the scan is in Stopped state
:return: The HTTP response'

def wait_until_finish(self, wait_loops=150):

    status = None
    for _ in xrange(wait_loops):
        time.sleep(0.5)
        response = self.app.get('/scans/', headers=self.HEADERS)
        self.assertEqual(response.status_code, 200, response.data)
        status = json.loads(response.data)['items'][0]['status']
        if (status != 'Running'):
            return response
    msg = 'Timeout    waiting    for    scan    to    finish,    latest    status    is:    "%s"'
    raise RuntimeError((msg % status))
