diff --git a/tests/mysql/model/test_model_scopes.py b/tests/mysql/model/test_model_scopes.py index 574424f5..28d37a6b 100644 --- a/tests/mysql/model/test_model_scopes.py +++ b/tests/mysql/model/test_model_scopes.py @@ -10,16 +10,16 @@ class User(Model, SoftDeletesMixin): class TestModelScopes(unittest.TestCase): def test_find_with_global_scope(self): - user_where = User.where("id", 1).to_sql() - user_find = User.find("1", query=True) - self.assertEqual(user_where, user_find) + find_sql = User.find("1", query=True).to_sql() + raw_sql = """SELECT * FROM `users` WHERE `users`.`id` = '1' AND `users`.`deleted_at` IS NULL""" + self.assertEqual(find_sql, raw_sql) def test_find_with_trashed_scope(self): - user_where = User.with_trashed().where("id", 1).to_sql() - user_find = User.with_trashed().find("1", query=True) - self.assertEqual(user_where, user_find) + find_sql = User.with_trashed().find("1", query=True).to_sql() + raw_sql = """SELECT * FROM `users` WHERE `users`.`id` = '1'""" + self.assertEqual(find_sql, raw_sql) def test_find_with_only_trashed_scope(self): - user_where = User.only_trashed().where("id", 1).to_sql() - user_find = User.only_trashed().find("1", query=True) - self.assertEqual(user_where, user_find) + find_sql = User.only_trashed().find("1", query=True).to_sql() + raw_sql = """SELECT * FROM `users` WHERE `users`.`deleted_at` IS NOT NULL AND `users`.`id` = '1'""" + self.assertEqual(find_sql, raw_sql)