'Test that codenames with leading or trailing whitespace still work'

def test_login_with_whitespace(self):

    def login_test(codename):
        resp = self.client.get('/login')
        self.assertEqual(resp.status_code, 200)
        self.assertIn('Enter    Codename', resp.data)
        with self.client as c:
            resp = c.post('/login', data=dict(codename=codename), follow_redirects=True)
            self.assertEqual(resp.status_code, 200)
            self.assertIn('Submit    Materials', resp.data)
            self.assertTrue(session['logged_in'])
            resp = c.get('/logout', follow_redirects=True)
    codename = self._new_codename()
    login_test((codename + '    '))
    login_test((('    ' + codename) + '    '))
    login_test(('    ' + codename))
