comparison venv/lib/python2.7/site-packages/github/tests/Issue140.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 github
26
27
28 class Issue140(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issues/140
29 def setUp(self):
30 Framework.TestCase.setUp(self)
31 self.repo = self.g.get_repo("twitter/bootstrap")
32
33 def testGetDirContentsThenLazyCompletionOfFile(self):
34 contents = self.repo.get_dir_contents("/js")
35 self.assertEqual(len(contents), 15)
36 n = 0
37 for content in contents:
38 if content.path == "js/bootstrap-affix.js":
39 self.assertEqual(len(content.content), 4722) # Lazy completion
40 n += 1
41 elif content.path == "js/tests":
42 self.assertEqual(content.content, None) # No completion at all
43 n += 1
44 self.assertEqual(n, 2)
45
46 def testGetFileContents(self):
47 contents = self.repo.get_file_contents("/js/bootstrap-affix.js")
48 self.assertEqual(contents.encoding, "base64")
49 self.assertEqual(contents.url, "https://api.github.com/repos/twitter/bootstrap/contents/js/bootstrap-affix.js")
50 self.assertEqual(len(contents.content), 4722)
51
52 def testGetDirContentsWithRef(self):
53 self.assertEqual(len(self.repo.get_dir_contents("/js", "8c7f9c66a7d12f47f50618ef420868fe836d0c33")), 15)