chore: migrate tests to also run with mariadb

This commit is contained in:
realaravinth
2022-07-22 19:14:18 +05:30
parent 912b342e0e
commit 249b6461ee
24 changed files with 352 additions and 59 deletions

View File

@@ -33,16 +33,16 @@ pub fn map_row_not_found_err(e: Error, row_not_found: DBError) -> DBError {
/// map postgres errors to [DBError](DBError) types
pub fn map_register_err(e: Error) -> DBError {
if let Error::Database(err) = e {
if err.code() == Some(Cow::from("23505")) {
if err.code() == Some(Cow::from("1602")) {
let msg = err.message();
println!("{}", msg);
if msg.contains("mcaptcha_users_name_key") {
if msg.contains("name") {
DBError::UsernameTaken
} else if msg.contains("mcaptcha_users_email_key") {
} else if msg.contains("email") {
DBError::EmailTaken
} else if msg.contains("mcaptcha_users_secret_key") {
} else if msg.contains("secret") {
DBError::SecretTaken
} else if msg.contains("mcaptcha_config_key_key") {
} else if msg.contains("captcha_key") {
DBError::CaptchaKeyTaken
} else {
DBError::DBError(Box::new(Error::Database(err)))