Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. import json
  2. import urllib
  3. from pprint import pprint
  4. from urllib import request, parse
  5. import pytest
  6.  
  7. from inspect import getsourcefile
  8. from os import path, sys
  9.  
  10. current_dir = path.dirname(path.abspath(getsourcefile(lambda:0)))
  11. sys.path.insert(0, current_dir[:current_dir.rfind(path.sep)])
  12.  
  13. from theroot.users_bundle.models.user import User
  14. from theroot import app
  15. from theroot.db import *
  16. from theroot.users_bundle.controllers import do_the_signup
  17. sys.path.pop(0)
  18. app.testing = True
  19. app.static_url_path = '',
  20. app.static_folder = 'web/static',
  21. app.template_folder = 'web/templates'
  22. c = app.test_client()
  23.  
  24.  
  25. class TestApp(app):
  26.  
  27. def test_create_user(self):
  28. values = {
  29. "data": {
  30. "email": "cicciopizzo101@gmail.com",
  31. "password": "test",
  32. "first_name": "ciccio",
  33. "last_name": "pizzo",
  34. "role": "1",
  35. "address": {
  36. "country": "Italy",
  37. "address_line": "Test Address, 1998, WXDJI Neverland, Italy",
  38. "coordinates": {
  39. "lat": "41.0914808",
  40. "long": "16.8672337"
  41. }
  42. }
  43. }
  44.  
  45. }
  46.  
  47. self.do_the_signup(values)
  48. # email = 'cicciorizzo02@gmail.com'
  49. # password = 'thesuperpassword'
  50. # user = User(email, password)
  51. # db.session.add(user)
  52. # db.session.commit()
  53. # pprint(user.email)
  54. user_name = ', '.join(db.session.query(User.email).filter_by(email=values['data']['email']).first())
  55. assert values['data']['email'] == user_name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement