Пример #1
0
def _q_index(request):
    errors = []
    user = request.user
    githubs = user.githubs
    if request.method == "POST":
        user_name = request.get_form_var('github')
        errors = CodeDoubanUserGithub.validate(user.name, user_name)
        if not errors:
            CodeDoubanUserGithub.add(user.name, user_name)
            return request.redirect('/settings/github')
    return st('/settings/github.html', **locals())
Пример #2
0
 def test_get_by_user_name(self):
     g1 = CodeDoubanUserGithub.add('testu1', 'testug1')
     g2 = CodeDoubanUserGithub.add('testu2', 'testug2')
     g3 = CodeDoubanUserGithub.get_by_user_name('testug2')
     assert g3.user_id == 'testu2'
Пример #3
0
 def test_get_by_user_name(self):
     g1 = CodeDoubanUserGithub.add('testu1', 'testug1')
     g2 = CodeDoubanUserGithub.add('testu2', 'testug2')
     g3 = CodeDoubanUserGithub.get_by_user_name('testug2')
     assert g3.user_id == 'testu2'
Пример #4
0
 def test_add_github(self):
     github = CodeDoubanUserGithub.add('testu', 'testug')
     assert github.user_name == 'testug'
     assert github.user_id == 'testu'
Пример #5
0
 def test_add_github(self):
     github = CodeDoubanUserGithub.add('testu', 'testug')
     assert github.user_name == 'testug'
     assert github.user_id == 'testu'