Added edge cases for secrets API, fixed flake8 issues, review comments

Change-Id: I919e9acee8d0a3f00682165f9320208361de8b7f