def setUp(self): class TestConfig(object): SQLALCHEMY_DATABASE_URI = 'sqlite://' DEBUG = True TESTING = True app.config.from_object(TestConfig()) self.app = app with self.app.test_request_context(): db.create_all() raw_users = [ { 'username': '******', 'email': '*****@*****.**', 'password': '******' }, { 'username': '******', 'email': '*****@*****.**', 'password': '******' }, { 'username': '******', 'email': '*****@*****.**', 'password': '******' } ] raw_groups = [ { 'name': 'group1' }, { 'name': 'group2' }, { 'name': 'group3' } ] for user in raw_users: password = user.pop('password') user = User(**user) user.set_password(password) user.save() for group in raw_groups: Group(**group).save()
def setUp(self): class TestConfig(object): SQLALCHEMY_DATABASE_URI = 'sqlite://' DEBUG = True TESTING = True app.config.from_object(TestConfig()) self.app = app with self.app.test_request_context(): db.create_all() raw_users = [{ 'username': '******', 'email': '*****@*****.**', 'password': '******' }, { 'username': '******', 'email': '*****@*****.**', 'password': '******' }, { 'username': '******', 'email': '*****@*****.**', 'password': '******' }] raw_groups = [{ 'name': 'group1' }, { 'name': 'group2' }, { 'name': 'group3' }] for user in raw_users: password = user.pop('password') user = User(**user) user.set_password(password) user.save() for group in raw_groups: Group(**group).save()
#!/usr/bin/python import os, sys import hashlib sys.path.insert(1, os.path.join(sys.path[0], '../src')) from main import db, User items = ['NumerousDiamond', 'AcceptableVillage', 'InformalEditor', 'ImportantRoad', 'HistoricalPainting', 'SexualClimate', 'ConsistentConcept', 'DesperateCoffee', 'ScaredFood', 'OddCurrency', 'AsleepImportance', 'GuiltyManager', 'ScaredGrandmother', 'PoliticalChapter', 'UnusualEmphasis', 'DramaticArt', 'InnerHealth', 'SevereAssociation', 'NiceInternet', 'ElectronicAffair', 'MedicalFeedback', 'ElectricalArrival', 'LatterExplanation', 'SufficientApartment', 'CulturalPeople', 'DistinctGirl', 'DangerousIdea', 'SeriousMeaning', 'SuitableCity', 'HotApplication', 'EasternActivity', 'SeveralGrandmother', 'KnownInsurance', 'EducationalOven', 'IntelligentBeer', 'PoorMoment', 'AdministrativeManagement', 'StrictContext', 'EfficientCandidate', 'MentalTale'] for item in items: u = User() u.username = item u.email = item.lower()+'@pnyx.app' u.password = hashlib.sha384(os.urandom(24)).hexdigest() u.save()