示例#1
0
    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, [])
示例#2
0
 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, [])
示例#3
0
 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, [])
示例#4
0
 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'
         })
示例#5
0
 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'
         })
示例#6
0
    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)
示例#7
0
 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'
         }
     )
示例#8
0
 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'
         }
     )
示例#9
0
    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",
            },
        )
示例#10
0
 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)
示例#11
0
 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)
示例#12
0
 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)
示例#13
0
 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)