def test_parse_url_fail(self): testcases = [ 'github.com/mingrammer/sorting/useless', 'github.com/django/' ] for tc in testcases: with self.assertRaises(Exception): parse_url(tc)
def check(): url = request.form['url'] try: parse_url(url) return redirect(url_for('report', repo_url=url)) except: flash('Given repository url is not valid') return redirect(url_for('index'))
def test_parse_url(self): testcases = [{ 'url': 'github.com/mingrammer/awesome-finder', 'name': 'awesome-finder', 'username': '******' }, { 'url': 'github.com/django/django', 'name': 'django', 'username': '******' }] for tc in testcases: username, name = parse_url(tc['url']) self.assertEqual(name, tc['name']) self.assertEqual(username, tc['username'])
def test_parse_url(self): testcases = [ { 'url': 'github.com/mingrammer/sorting', 'name': 'sorting', 'username': '******' }, { 'url': 'github.com/django/django', 'name': 'django', 'username': '******' } ] for tc in testcases: username, name = parse_url(tc['url']) self.assertEqual(name, tc['name']) self.assertEqual(username, tc['username'])