rozek avatar
rozek
Authorization_from_SQLite_Test
HTTP
Here are some tests for val Authorization_from_SQLite Test Cases Positive Test Cases Valid credentials with existing user TableName: "Authorization_from_SQLite_Test" Database content: UserId "alice", PasswordHash "{PBKDF2}10000$salt123$hashedPassword123" Authorization header: "Basic " + btoa("alice:correctPassword") Expected result: true Valid credentials with case-insensitive UserId TableName: "Authorization_from_SQLite_Test" Database content: UserId "Bob", PasswordHash "{PBKDF2}10000$salt456$hashedPassword456" Authorization header: "Basic " + btoa("bob:correctPassword") Expected result: true Negative Test Cases Invalid password TableName: "Authorization_from_SQLite_Test" Database content: UserId "charlie", PasswordHash "{PBKDF2}10000$salt789$hashedPassword789" Authorization header: "Basic " + btoa("charlie:wrongPassword") Expected result: false No Authorization header TableName: "Authorization_from_SQLite_Test" Database content: UserId "david", PasswordHash "{PBKDF2}10000$saltABC$hashedPasswordABC" Authorization header: undefined Expected result: false Non-existent user TableName: "Authorization_from_SQLite_Test" Database content: (empty) Authorization header: "Basic " + btoa("eve:anyPassword") Expected result: false Error Cases Invalid table name TableName: "1INVALID" Authorization header: "Basic " + btoa("frank:password") Expected result: Error thrown Edge Cases Empty string as password TableName: "Authorization_from_SQLite_Test" Database content: UserId "grace", PasswordHash "{PBKDF2}10000$saltDEF$hashedEmptyPassword" Authorization header: "Basic " + btoa("grace:") Expected result: true (if the empty password hashes correctly) Non-Basic authorization type TableName: "Authorization_from_SQLite_Test" Database content: UserId "henry", PasswordHash "{PBKDF2}10000$saltGHI$hashedPasswordGHI" Authorization header: "Bearer " + btoa("henry:password") Expected result: false Malformed PasswordHash in database TableName: "Authorization_from_SQLite_Test" Database content: UserId "isaac", PasswordHash "malformedHash" Authorization header: "Basic " + btoa("isaac:password") Expected result: false Very long UserId (at 256 character limit) TableName: "Authorization_from_SQLite_Test" Database content: UserId (256 'a' characters), PasswordHash "{PBKDF2}10000$saltJKL$hashedPasswordJKL" Authorization header: "Basic " + btoa("a".repeat(256) + ":password") Expected result: true (if password is correct) UserId exceeding 256 characters TableName: "Authorization_from_SQLite_Test" Authorization header: "Basic " + btoa("a".repeat(257) + ":password") Expected result: false (as it shouldn't exist in the database) Empty UserId TableName: "Authorization_from_SQLite_Test" Authorization header: "Basic " + btoa(":password") Expected result: false
0
1
Next
Updated: January 30, 2025