finished tests for security middleware