'Test the "delete collection" button on each collection page'

def test_delete_collection(self):

    self.source_app.get('/generate')
    self.source_app.post('/create')
    self.source_app.post('/submit', data=dict(msg='This    is    a    test.', fh=(StringIO(''), '')), follow_redirects=True)
    resp = self.journalist_app.get('/')
    soup = BeautifulSoup(resp.data, 'html.parser')
    first_col_url = soup.select('ul#cols    >    li    a')[0]['href']
    resp = self.journalist_app.get(first_col_url)
    self.assertEqual(resp.status_code, 200)
    soup = BeautifulSoup(resp.data, 'html.parser')
    delete_form_inputs = soup.select('form#delete-collection')[0]('input')
    sid = delete_form_inputs[1]['value']
    col_name = delete_form_inputs[2]['value']
    resp = self.journalist_app.post(('/col/delete/' + sid), follow_redirects=True)
    self.assertEquals(resp.status_code, 200)
    self.assertIn(escape(("%s's    collection    deleted" % (col_name,))), resp.data)
    self.assertIn('No    documents    have    been    submitted!', resp.data)
    utils.async.wait_for_assertion((lambda : self.assertFalse(os.path.exists(store.path(sid)))))
