Mercurial > repos > bcclaywell > argo_navis
comparison venv/lib/python2.7/site-packages/github/tests/Search.py @ 0:d67268158946 draft
planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
author | bcclaywell |
---|---|
date | Mon, 12 Oct 2015 17:43:33 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d67268158946 |
---|---|
1 # -*- coding: utf-8 -*- | |
2 | |
3 # ########################## Copyrights and license ############################ | |
4 # # | |
5 # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> # | |
6 # # | |
7 # This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ # | |
8 # # | |
9 # PyGithub is free software: you can redistribute it and/or modify it under # | |
10 # the terms of the GNU Lesser General Public License as published by the Free # | |
11 # Software Foundation, either version 3 of the License, or (at your option) # | |
12 # any later version. # | |
13 # # | |
14 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # | |
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # | |
16 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # | |
17 # details. # | |
18 # # | |
19 # You should have received a copy of the GNU Lesser General Public License # | |
20 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # | |
21 # # | |
22 # ############################################################################## | |
23 | |
24 import Framework | |
25 import sys | |
26 | |
27 atLeastPython3 = sys.hexversion >= 0x03000000 | |
28 | |
29 | |
30 class Search(Framework.TestCase): | |
31 def setUp(self): | |
32 Framework.TestCase.setUp(self) | |
33 | |
34 def testSearchUsers(self): | |
35 users = self.g.search_users("vincent", sort="followers", order="desc") | |
36 self.assertEqual(users.totalCount, 2781) | |
37 self.assertEqual(users[0].login, "nvie") | |
38 self.assertEqual(users[14].login, "Vayn") | |
39 | |
40 def testPaginateSearchUsers(self): | |
41 users = self.g.search_users("", location="Berlin") | |
42 self.assertListKeyBegin(users, lambda u: u.login, [u'cloudhead', u'felixge', u'sferik', u'rkh', u'jezdez', u'janl', u'marijnh', u'nikic', u'igorw', u'froschi', u'svenfuchs', u'omz', u'chad', u'bergie', u'roidrage', u'pcalcado', u'durran', u'hukl', u'mttkay', u'aFarkas', u'ole', u'hagenburger', u'jberkel', u'naderman', u'joshk', u'pudo', u'robb', u'josephwilk', u'hanshuebner', u'txus', u'paulasmuth', u'splitbrain', u'langalex', u'bendiken', u'stefanw']) | |
43 self.assertEqual(users.totalCount, 6038) | |
44 | |
45 def testGetPageOnSearchUsers(self): | |
46 users = self.g.search_users("", location="Berlin") | |
47 self.assertEqual([u.login for u in users.get_page(7)], [u'ursachec', u'bitboxer', u'fs111', u'michenriksen', u'witsch', u'booo', u'mortice', u'r0man', u'MikeBild', u'mhagger', u'bkw', u'fwbrasil', u'mschneider', u'lydiapintscher', u'asksven', u'iamtimm', u'sneak', u'kr1sp1n', u'Feh', u'GordonLesti', u'annismckenzie', u'eskimoblood', u'tsujigiri', u'riethmayer', u'lauritzthamsen', u'scotchi', u'peritor', u'toto', u'hwaxxer', u'lukaszklis']) | |
48 | |
49 def testSearchRepos(self): | |
50 repos = self.g.search_repositories("github", sort="stars", order="desc", language="Python") | |
51 self.assertListKeyBegin(repos, lambda r: r.full_name, [u'kennethreitz/legit', u'RuudBurger/CouchPotatoV1', u'gelstudios/gitfiti', u'gpjt/webgl-lessons', u'jacquev6/PyGithub', u'aaasen/github_globe', u'hmason/gitmarks', u'dnerdy/factory_boy', u'binaryage/drydrop', u'bgreenlee/sublime-github', u'karan/HackerNewsAPI', u'mfenniak/pyPdf', u'skazhy/github-decorator', u'llvmpy/llvmpy', u'lexrupy/gmate', u'ask/python-github2', u'audreyr/cookiecutter-pypackage', u'tabo/django-treebeard', u'dbr/tvdb_api', u'jchris/couchapp', u'joeyespo/grip', u'nigelsmall/py2neo', u'ask/chishop', u'sigmavirus24/github3.py', u'jsmits/github-cli', u'lincolnloop/django-layout', u'amccloud/django-project-skel', u'Stiivi/brewery', u'webpy/webpy.github.com', u'dustin/py-github', u'logsol/Github-Auto-Deploy', u'cloudkick/libcloud', u'berkerpeksag/github-badge', u'bitprophet/ssh', u'azavea/OpenTreeMap']) | |
52 | |
53 def testSearchIssues(self): | |
54 issues = self.g.search_issues("compile", sort="comments", order="desc", language="C++") | |
55 self.assertListKeyBegin(issues, lambda i: i.id, [12068673, 23250111, 14371957, 9423897, 24277400, 2408877, 11338741, 13980502, 27697165, 23102422]) | |
56 | |
57 def testSearchCode(self): | |
58 files = self.g.search_code("toto", sort="indexed", order="asc", user="jacquev6") | |
59 self.assertListKeyEqual(files, lambda f: f.name, [u'Commit.setUp.txt', u'PullRequest.testGetFiles.txt', u'NamedUser.testGetEvents.txt', u'PullRequest.testCreateComment.txt', u'PullRequestFile.setUp.txt', u'Repository.testGetIssuesWithWildcards.txt', u'Repository.testGetIssuesWithArguments.txt', u'test_ebnf.cpp', u'test_abnf.cpp', u'PullRequestFile.py', u'SystemCalls.py', u'tests.py', u'LexerTestCase.py', u'ParserTestCase.py']) | |
60 self.assertEqual(files[0].repository.full_name, "jacquev6/PyGithub") | |
61 if atLeastPython3: | |
62 self.assertEqual(files[0].decoded_content[:30], b'https\nGET\napi.github.com\nNone\n') | |
63 else: | |
64 self.assertEqual(files[0].decoded_content[:30], "https\nGET\napi.github.com\nNone\n") | |
65 | |
66 def testUrlquotingOfQualifiers(self): | |
67 # Example taken from #236 | |
68 issues = self.g.search_issues("repo:saltstack/salt-api type:Issues", updated=">2014-03-04T18:28:11Z") | |
69 self.assertEqual(issues[0].id, 29138794) | |
70 | |
71 def testUrlquotingOfQuery(self): | |
72 # Example taken from #236 | |
73 issues = self.g.search_issues("repo:saltstack/salt-api type:Issues updated:>2014-03-04T18:28:11Z") | |
74 self.assertEqual(issues[0].id, 29138794) |