Added edge cases for secrets API, fix flake8 issues

Change-Id: I8df6f9dcba7fd49632b4af4b298f9d39ea48aa5d