'Attempting to login with an overly long codename should result in
an error, and scrypt should not be called to avoid DoS.'

@patch('crypto_util.hash_codename')
def test_login_with_overly_long_codename(self, mock_hash_codename):

    overly_long_codename = ('a' * (Source.MAX_CODENAME_LEN + 1))
    with self.client as c:
        resp = c.post('/login', data=dict(codename=overly_long_codename), follow_redirects=True)
        self.assertEqual(resp.status_code, 200)
        self.assertIn('Sorry,    that    is    not    a    recognized    codename.', resp.data)
        self.assertFalse(mock_hash_codename.called, 'Called    hash_codename    for    codename    w/    invalid    length')
