comparison venv/lib/python2.7/site-packages/github/tests/Persistence.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 if Framework.atLeastPython26:
28 from io import BytesIO as IO
29 else:
30 from StringIO import StringIO as IO
31
32
33 class Persistence(Framework.TestCase):
34 def setUp(self):
35 Framework.TestCase.setUp(self)
36 self.repo = self.g.get_repo("akfish/PyGithub")
37
38 self.dumpedRepo = IO()
39 self.g.dump(self.repo, self.dumpedRepo)
40 self.dumpedRepo.seek(0)
41
42 def tearDown(self):
43 self.dumpedRepo.close()
44
45 def testLoad(self):
46 loadedRepo = self.g.load(self.dumpedRepo)
47 self.assertTrue(isinstance(loadedRepo, github.Repository.Repository))
48 self.assertTrue(loadedRepo._requester is self.repo._requester)
49 self.assertTrue(loadedRepo.owner._requester is self.repo._requester)
50 self.assertEqual(loadedRepo.name, "PyGithub")
51 self.assertEqual(loadedRepo.url, "https://api.github.com/repos/akfish/PyGithub")
52
53 def testLoadAndUpdate(self):
54 loadedRepo = self.g.load(self.dumpedRepo)
55 self.assertTrue(loadedRepo.update())