コード例 #1
0
    def test_update(self):
        conf = TwitterConfig.update(self.u, self.key, self.secret)

        self.key = 'new_key'
        self.secret = 'new_secret'
        conf = TwitterConfig.update(self.u, self.key, self.secret)

        self.assertEqual(self.key, conf.token_key)
        self.assertEqual(self.secret, conf.token_secret)
コード例 #2
0
    def test_get(self):
        conf1 = TwitterConfig.update(self.u, self.key, self.secret)
        conf2 = TwitterConfig.get_by_user(self.u)

        self.assertEquals(conf1, conf2)
        self.assertEqual(self.key, conf2.token_key)
        self.assertEqual(self.secret, conf2.token_secret)
        self.assertEqual(self.u.id, conf2.user_id)
コード例 #3
0
    def setUp(self):
        super(IndexTestCase, self).setUp()

        self.username = '******'
        self.email = '*****@*****.**'
        self.password = '******'

        self.u = User.register(self.username, self.email, self.password)
        self.key = 'key'
        self.token = 'token'
        self.conf = TwitterConfig.update(self.u, self.key, self.token)
コード例 #4
0
    def setUp(self):
        super(IndexTestCase, self).setUp()

        self.username = '******'
        self.email = '*****@*****.**'
        self.password = '******'

        self.u = User.register(self.username,
                               self.email,
                               self.password)
        self.key = 'key'
        self.token = 'token'
        self.conf = TwitterConfig.update(self.u, self.key, self.token)
コード例 #5
0
def config():
    config = None

    if request.method == 'POST':
        form = ConfigForm()
        if form.validate_on_submit():
            config = TwitterConfig.update(login.current_user,
                                          form.token_key.data,
                                          form.token_secret.data)

    if config is None:
        config = TwitterConfig.get_by_user(login.current_user)

    return render_template('config.html',
                           current_page='Twitter Configuration',
                           twitter_config=config)
コード例 #6
0
    def test_create(self):
        conf = TwitterConfig.update(self.u, self.key, self.secret)

        self.assertEqual(self.key, conf.token_key)
        self.assertEqual(self.secret, conf.token_secret)