Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import urllib
- from pprint import pprint
- from urllib import request, parse
- import pytest
- from inspect import getsourcefile
- from os import path, sys
- current_dir = path.dirname(path.abspath(getsourcefile(lambda:0)))
- sys.path.insert(0, current_dir[:current_dir.rfind(path.sep)])
- from theroot.users_bundle.models.user import User
- from theroot import app
- from theroot.db import *
- from theroot.users_bundle.controllers import do_the_signup
- sys.path.pop(0)
- app.testing = True
- app.static_url_path = '',
- app.static_folder = 'web/static',
- app.template_folder = 'web/templates'
- c = app.test_client()
- class TestApp(app):
- def test_create_user(self):
- values = {
- "data": {
- "email": "cicciopizzo101@gmail.com",
- "password": "test",
- "first_name": "ciccio",
- "last_name": "pizzo",
- "role": "1",
- "address": {
- "country": "Italy",
- "address_line": "Test Address, 1998, WXDJI Neverland, Italy",
- "coordinates": {
- "lat": "41.0914808",
- "long": "16.8672337"
- }
- }
- }
- }
- self.do_the_signup(values)
- # email = 'cicciorizzo02@gmail.com'
- # password = 'thesuperpassword'
- # user = User(email, password)
- # db.session.add(user)
- # db.session.commit()
- # pprint(user.email)
- user_name = ', '.join(db.session.query(User.email).filter_by(email=values['data']['email']).first())
- assert values['data']['email'] == user_name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement