Skip to content

Instantly share code, notes, and snippets.

@Deviad
Created July 21, 2017 22:52
Show Gist options
  • Save Deviad/c276d378acc2a5e55d14509b604d6761 to your computer and use it in GitHub Desktop.
Save Deviad/c276d378acc2a5e55d14509b604d6761 to your computer and use it in GitHub Desktop.
app_unit_tests_.py:25: in <module> class TestApp(app): ../lib/python3.6/site-packages/flask/app.py:539: in __init__ self.add_url_rule(self.static_url_path + '/<path:filename>', E TypeError: can only concatenate tuple (not "str") to tuple
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment