예제 #1
0
 def test_fail_register(self):
     r = YayClient.register(self.opts, '    ', '*****@*****.**', 'a', 'a')
     j = simplejson.loads(r.content)
     self.assertEqual(r.status_code, 401)
     r = YayClient.register(self.opts, 'my\'name', '*****@*****.**', 'a', 'a')
     j = simplejson.loads(r.content)
     self.assertEqual(r.status_code, 401)
예제 #2
0
 def test_fail_register(self):
     r = YayClient.register(self.opts, '    ', '*****@*****.**', 'a', 'a')
     self.assertFalse(YayClient.is_logged_in(self.opts, r.cookies))
     r = YayClient.register(self.opts, 'my\'name', '*****@*****.**', 'a', 'a')
     self.assertFalse(YayClient.is_logged_in(self.opts, r.cookies))
     r = YayClient.register(self.opts, 'a  b', '*****@*****.**', 'a', 'a')
     self.assertFalse(YayClient.is_logged_in(self.opts, r.cookies))
     r = YayClient.register(self.opts, 'a_b', '*****@*****.**', 'a', 'a')
     self.assertFalse(YayClient.is_logged_in(self.opts, r.cookies))
     r = YayClient.register(self.opts, 'a-b', '*****@*****.**', 'a', 'a')
     self.assertFalse(YayClient.is_logged_in(self.opts, r.cookies))
예제 #3
0
 def test_fail_register(self):
     r = YayClient.register(self.opts, '    ', '*****@*****.**', 'a', 'a')
     self.assertFalse(YayClient.is_logged_in(self.opts, r.cookies))
     r = YayClient.register(self.opts, 'my\'name', '*****@*****.**', 'a', 'a')
     self.assertFalse(YayClient.is_logged_in(self.opts, r.cookies))
     r = YayClient.register(self.opts, 'a  b', '*****@*****.**', 'a', 'a')
     self.assertFalse(YayClient.is_logged_in(self.opts, r.cookies))
     r = YayClient.register(self.opts, 'a_b', '*****@*****.**', 'a', 'a')
     self.assertFalse(YayClient.is_logged_in(self.opts, r.cookies))
     r = YayClient.register(self.opts, 'a-b', '*****@*****.**', 'a', 'a')
     self.assertFalse(YayClient.is_logged_in(self.opts, r.cookies))
예제 #4
0
    def setUpClass(cls):

        cls.opts = dict(
            url = 'http://yayhooray.dev/'
        )

        user = YayClient.register(cls.opts, 'yay2tester', '*****@*****.**', 'a', 'a')
        thread = YayClient.post_thread(cls.opts, user.cookies, 2, "Test", "Test")

        cls.cookies = user.cookies
        cls.thread = urlparse(thread.url).path[1:]
예제 #5
0
    def setUpClass(cls):
        cfg = SafeConfigParser()
        cfg.read(['../yay.ini', 'tests/yay.ini'])
        cls.opts = dict(
            url = cfg.get('site', 'url')
        )

        DbClient.reset_database(cfg.get('db', 'host'), cfg.get('db', 'database'),
                                cfg.get('db', 'username'), cfg.get('db', 'password'))


        user = YayClient.register(cls.opts, 'yay2tester', '*****@*****.**', 'a', 'a')
        thread = YayClient.post_thread(cls.opts, user.cookies, 2, "Test", "Test")
        cls.cookies = user.cookies
        cls.thread = urlparse(thread.url).path[1:]
예제 #6
0
    def setUpClass(cls):
        cfg = SafeConfigParser()
        cfg.read(['../yay.ini', 'tests/yay.ini'])
        cls.opts = dict(
            url = cfg.get('site', 'url')
        )

        DbClient.reset_database(cfg.get('db', 'host'), cfg.get('db', 'database'),
                                cfg.get('db', 'username'), cfg.get('db', 'password'))


        user = YayClient.register(cls.opts, 'yay2tester', '*****@*****.**', 'a', 'a')
        thread = YayClient.post_thread(cls.opts, user.cookies, 2, "Test", "Test")
        cls.cookies = user.cookies
        cls.thread = urlparse(thread.url).path[1:]
예제 #7
0
    def test_yay_register(self):

        # register existing yay username
        r = YayClient.register(self.opts, 'dh', '*****@*****.**', 'a', 'a')
        j = simplejson.loads(r.content)
        self.assertEqual(j['method'], 'yaypm')
        self.assertEqual(r.status_code, 201)
        self.assertFalse(YayClient.is_logged_in(self.opts, r.cookies))

        # attempt to login, should fail because not activated
        failed_login = YayClient.login(self.opts, 'dh', 'a')
        self.assertEqual(failed_login.status_code, 401)
        self.assertFalse(YayClient.is_logged_in(self.opts, failed_login.cookies))

        # perform activation
        activate_url = OldYayClient.read_last_pm_link('yayname', 'yaypass')
        activate = requests.get(activate_url)
        self.assertEqual(activate.status_code, 200)

        # Yay, should now be able to login
        login = YayClient.login(self.opts, 'dh', 'a')
        self.assertEqual(login.status_code, 200)
        self.assertTrue(YayClient.is_logged_in(self.opts, login.cookies))
예제 #8
0
def create_users(opts, num):
    return [
        YayClient.register(opts, user['name'], user['email'], user['password'],
                           user['password']) for user in users_generator(num)
    ]
예제 #9
0
def create_users(opts, num):
    return [
        YayClient.register(opts, user['name'], user['email'], user['password'], user['password'])
        for user in users_generator(num)
    ]
예제 #10
0
 def test_forgot_password(self):
     YayClient.register(self.opts, 'emailtest', '*****@*****.**', 'a', 'a')
     r = YayClient.forgot_password(self.opts, '*****@*****.**')
     j = simplejson.loads(r.content)
     self.assertTrue(j['ok'])
     self.assertEqual(r.status_code, 200)
예제 #11
0
 def test_new_register(self):
     r = YayClient.register(self.opts, 'neudjcshfo', '*****@*****.**', 'a', 'a')
     j = simplejson.loads(r.content)
     self.assertEqual(j['method'], 'plain')
     self.assertEqual(r.status_code, 201)
     self.assertTrue(YayClient.is_logged_in(self.opts, r.cookies))
예제 #12
0
 def test_new_register(self):
     r = YayClient.register(self.opts, 'neudjcshfo', '*****@*****.**', 'a', 'a')
     self.assertTrue(YayClient.is_logged_in(self.opts, r.cookies))
     r = YayClient.register(self.opts, 'a b', '*****@*****.**', 'a', 'a')
     self.assertTrue(YayClient.is_logged_in(self.opts, r.cookies))
예제 #13
0
 def test_forgot_password(self):
     YayClient.register(self.opts, 'emailtest', '*****@*****.**', 'a', 'a')
     r = YayClient.forgot_password(self.opts, '*****@*****.**')
     j = simplejson.loads(r.content)
     self.assertTrue(j['ok'])
     self.assertEqual(r.status_code, 200)
예제 #14
0
 def test_new_register(self):
     r = YayClient.register(self.opts, 'neudjcshfo', '*****@*****.**', 'a', 'a')
     self.assertTrue(YayClient.is_logged_in(self.opts, r.cookies))
     r = YayClient.register(self.opts, 'a b', '*****@*****.**', 'a', 'a')
     self.assertTrue(YayClient.is_logged_in(self.opts, r.cookies))