That's because you are logging in
sudo -H -u cbttest -i
As shown by your command prompt on the next line:
Once you have logged in
as cbttest, the sudo restrictions no longer apply--because the sudo restrictions are for user alex
launching commands as cbttest
. You are no longer "alex" after logging in as cbttest.
In addition, sudo will only check against commands invoked with sudo
. The sudo program does not monitor all shell activity.
To get the behavior you want, you must execute the commands as user alex and of the form "sudo -u cbttest [command]".