def test_registration_submit_schema_succeed(self): from shootout.views import user_add from shootout.models import User self.config.include("shootout.addroutes") request = testing.DummyRequest( post={ "form.submitted": u"Register", "username": u"username", "password": u"secret", "confirm_password": u"secret", "email": u"*****@*****.**", "name": u"John Doe", } ) user_add(request) users = self.session.query(User).all() self.assertEqual(len(users), 1) user = users[0] self.assertEqual(user.username, u"username") self.assertEqual(user.name, u"John Doe") self.assertEqual(user.email, u"*****@*****.**") self.assertEqual(user.hits, 0) self.assertEqual(user.misses, 0) self.assertEqual(user.delivered_hits, 0) self.assertEqual(user.delivered_misses, 0) self.assertEqual(user.ideas, []) self.assertEqual(user.voted_ideas, [])
def test_registration_submit_schema_succeed(self): from shootout.views import user_add from shootout.models import User _registerRoutes(self.config) request = testing.DummyRequest( post={ 'form.submitted': u'Register', 'username': u'username', 'password': u'secret', 'confirm_password': u'secret', 'email': u'*****@*****.**', 'name': u'John Doe', } ) user_add(request) users = self.session.query(User).all() self.assertEqual(len(users), 1) user = users[0] self.assertEqual(user.username, u'username') self.assertEqual(user.name, u'John Doe') self.assertEqual(user.email, u'*****@*****.**') self.assertEqual(user.hits, 0) self.assertEqual(user.misses, 0) self.assertEqual(user.delivered_hits, 0) self.assertEqual(user.delivered_misses, 0) self.assertEqual(user.ideas, []) self.assertEqual(user.voted_ideas, [])
def test_registration_submit_schema_succeed(self): from shootout.views import user_add from shootout.models import User self.config.include('shootout.addroutes') request = testing.DummyRequest( post={ 'form.submitted': u'Register', 'username': u'username', 'password': u'secret', 'confirm_password': u'secret', 'email': u'*****@*****.**', 'name': u'John Doe', }) user_add(request) users = self.session.query(User).all() self.assertEqual(len(users), 1) user = users[0] self.assertEqual(user.username, u'username') self.assertEqual(user.name, u'John Doe') self.assertEqual(user.email, u'*****@*****.**') self.assertEqual(user.hits, 0) self.assertEqual(user.misses, 0) self.assertEqual(user.delivered_hits, 0) self.assertEqual(user.delivered_misses, 0) self.assertEqual(user.ideas, []) self.assertEqual(user.voted_ideas, [])
def test_registration_submit_empty(self): from shootout.views import user_add self.config.include(register_templates) request = testing.DummyRequest() result = user_add(request) self.assertTrue('form' in result) request = testing.DummyRequest(post={'form.submitted': 'Shoot'}) result = user_add(request) self.assertEqual( result['form'].form.errors, { 'username': u'Missing value', 'confirm_password': u'Missing value', 'password': u'Missing value', 'email': u'Missing value', 'name': u'Missing value' })
def test_registration_submit_empty(self): from shootout.views import user_add _registerCommonTemplates(self.config) request = testing.DummyRequest() result = user_add(request) self.assertEqual(result['form'].form.is_validated, False) request = testing.DummyRequest(post={'form.submitted': 'Shoot'}) result = user_add(request) self.assertEqual( result['form'].form.errors, { 'username': u'Missing value', 'confirm_password': u'Missing value', 'password': u'Missing value', 'email': u'Missing value', 'name': u'Missing value' })
def test_registration_nosubmit(self): from shootout.views import user_add self.config.include(register_templates) request = testing.DummyRequest() result = user_add(request) self.assertTrue("form" in result)
def test_registration_submit_empty(self): from shootout.views import user_add _registerCommonTemplates(self.config) request = testing.DummyRequest() result = user_add(request) self.assertEqual(result['form'].form.is_validated, False) request = testing.DummyRequest(post={'form.submitted': 'Shoot'}) result = user_add(request) self.assertEqual( result['form'].form.errors, { 'username': u'Missing value', 'confirm_password': u'Missing value', 'password': u'Missing value', 'email': u'Missing value', 'name': u'Missing value' } )
def test_registration_submit_empty(self): from shootout.views import user_add self.config.include(register_templates) request = testing.DummyRequest() result = user_add(request) self.assertTrue('form' in result) request = testing.DummyRequest(post={'form.submitted': 'Shoot'}) result = user_add(request) self.assertEqual( result['form'].form.errors, { 'username': u'Missing value', 'confirm_password': u'Missing value', 'password': u'Missing value', 'email': u'Missing value', 'name': u'Missing value' } )
def test_registration_submit_empty(self): from shootout.views import user_add self.config.include(register_templates) request = testing.DummyRequest() result = user_add(request) self.assertTrue("form" in result) request = testing.DummyRequest(post={"form.submitted": "Shoot"}) result = user_add(request) self.assertEqual( result["form"].form.errors, { "username": u"Missing value", "confirm_password": u"Missing value", "password": u"Missing value", "email": u"Missing value", "name": u"Missing value", }, )
def test_registration_nosubmit(self): from shootout.views import user_add _registerCommonTemplates(self.config) request = testing.DummyRequest() result = user_add(request) self.assertEqual(result['form'].form.is_validated, False)
def test_registration_nosubmit(self): from shootout.views import user_add _registerCommonTemplates(self.config) request = testing.DummyRequest() result = user_add(request) self.assertTrue('form' in result)
def test_registration_nosubmit(self): from shootout.views import user_add self.config.include(register_templates) request = testing.DummyRequest() result = user_add(request) self.assertTrue('form' in result)