mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-03 10:43:40 -05:00 
			
		
		
		
	* refactor(backend): ♻️ cleanup duplicate code in http services * refactor(backend): ♻️ refactor database away from singleton design removed the database single and instead injected the session into a new Database class that is created during each request life-cycle. Now sessions no longer need to be passed into each method on the database All tests pass, but there are likely some hidden breaking changes that were not discovered. * fix venv * disable venv cache * fix install script * bump poetry version * postgres fixes * revert install * fix db initialization for postgres * add postgres to docker * refactor(backend): ♻️ cleanup unused and duplicate code in http services * refactor(backend): remove sessions from arguments * refactor(backend): ♻️ convert units and ingredients to use http service class * test(backend): ✅ add unit and food tests * lint * update tags * re-enable cache * fix missing fraction in db * fix lint Co-authored-by: hay-kot <hay-kot@pm.me>
		
			
				
	
	
		
			29 lines
		
	
	
		
			777 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			777 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import random
 | 
						|
import string
 | 
						|
 | 
						|
from mealie.schema.user.registration import CreateUserRegistration
 | 
						|
 | 
						|
 | 
						|
def random_string(length=10) -> str:
 | 
						|
    return "".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(length)).strip()
 | 
						|
 | 
						|
 | 
						|
def random_email(length=10) -> str:
 | 
						|
    return "".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(length)) + "@fake.com"
 | 
						|
 | 
						|
 | 
						|
def random_bool() -> bool:
 | 
						|
    return bool(random.getrandbits(1))
 | 
						|
 | 
						|
 | 
						|
def user_registration_factory() -> CreateUserRegistration:
 | 
						|
    return CreateUserRegistration(
 | 
						|
        group=random_string(),
 | 
						|
        email=random_email(),
 | 
						|
        username=random_string(),
 | 
						|
        password="fake-password",
 | 
						|
        password_confirm="fake-password",
 | 
						|
        advanced=False,
 | 
						|
        private=False,
 | 
						|
    )
 |