def test_users(self): u = User(username='******', email='*****@*****.**', password='******') db.session.add(u) db.session.commit() u = User.query.filter_by(username='******').first() assert u.username == 'sergey' assert u.is_authenticated is True assert u.is_active is True u.active = False assert u.is_active is False assert u.is_anonymous is False id = u.get_id() assert str(u.id) == id
red = random.randrange(0, 255) blue = random.randrange(0, 255) green = random.randrange(0, 255) pixel[random.randint(1, x - 1), random.randint(1, y - 1)] = (red, blue, green) return testImage print('CLEAR DATABASE') db.drop_all() print('CREATE TABLES') db.create_all() print('\nGENERATE USERS') u = User(username='******', email='*****@*****.**', password='******') u.role = 0 db.session.add(u) print('USER: Sergey') for _ in range(0, 10): username = fake_en.first_name().lower() email = username + '@' + fake_en.free_email_domain() password = '******' if (not User.username_exist(username)) and (not User.email_exist(email)): u = User(username=username, email=email, password=password) db.session.add(u) print(u) else: print('user or email is exist: ' + username + ' [' + email + ']')
red = random.randrange(0, 255) blue = random.randrange(0, 255) green = random.randrange(0, 255) pixel[random.randint(1, x-1), random.randint(1, y-1)] = (red, blue, green) return testImage print('CLEAR DATABASE') db.drop_all() print('CREATE TABLES') db.create_all() print('\nGENERATE USERS') u = User( username='******', email='*****@*****.**', password='******' ) u.role = 0 db.session.add(u) print('USER: Sergey') for _ in range(0, 10): username = fake_en.first_name().lower() email = username + '@' + fake_en.free_email_domain() password = '******' if (not User.username_exist(username)) and (not User.email_exist(email)): u = User( username=username, email=email, password=password