コード例 #1
0
ファイル: test_web.py プロジェクト: kankri/dulwich
 def test_get_loose_object(self):
     blob = make_object(Blob, data='foo')
     backend = _test_backend([blob])
     mat = re.search('^(..)(.{38})$', blob.id)
     output = ''.join(get_loose_object(self._req, backend, mat))
     self.assertEquals(blob.as_legacy_object(), output)
     self.assertEquals(HTTP_OK, self._status)
     self.assertContentTypeEquals('application/x-git-loose-object')
     self.assertTrue(self._req.cached)
コード例 #2
0
ファイル: test_web.py プロジェクト: Reidsy/AppengineGit
 def test_get_loose_object(self):
     blob = make_object(Blob, data='foo')
     backend = _test_backend([blob])
     mat = re.search('^(..)(.{38})$', blob.id)
     output = ''.join(get_loose_object(self._req, backend, mat))
     self.assertEquals(blob.as_legacy_object(), output)
     self.assertEquals(HTTP_OK, self._status)
     self.assertContentTypeEquals('application/x-git-loose-object')
     self.assertTrue(self._req.cached)
コード例 #3
0
 def test_get_loose_object(self):
     blob = make_object(Blob, data=b"foo")
     backend = _test_backend([blob])
     mat = re.search("^(..)(.{38})$", blob.id.decode("ascii"))
     output = b"".join(get_loose_object(self._req, backend, mat))
     self.assertEqual(blob.as_legacy_object(), output)
     self.assertEqual(HTTP_OK, self._status)
     self.assertContentTypeEquals("application/x-git-loose-object")
     self.assertTrue(self._req.cached)
コード例 #4
0
ファイル: test_web.py プロジェクト: Reidsy/AppengineGit
    def test_get_loose_object_error(self):
        blob = make_object(Blob, data='foo')
        backend = _test_backend([blob])
        mat = re.search('^(..)(.{38})$', blob.id)

        def as_legacy_object_error():
            raise IOError

        blob.as_legacy_object = as_legacy_object_error
        list(get_loose_object(self._req, backend, mat))
        self.assertEquals(HTTP_ERROR, self._status)
コード例 #5
0
ファイル: test_web.py プロジェクト: kankri/dulwich
    def test_get_loose_object_error(self):
        blob = make_object(Blob, data='foo')
        backend = _test_backend([blob])
        mat = re.search('^(..)(.{38})$', blob.id)

        def as_legacy_object_error():
            raise IOError

        blob.as_legacy_object = as_legacy_object_error
        list(get_loose_object(self._req, backend, mat))
        self.assertEquals(HTTP_ERROR, self._status)
コード例 #6
0
    def test_get_loose_object_error(self):
        blob = make_object(Blob, data=b"foo")
        backend = _test_backend([blob])
        mat = re.search("^(..)(.{38})$", blob.id.decode("ascii"))

        def as_legacy_object_error(self):
            raise IOError

        self.addCleanup(setattr, Blob, "as_legacy_object", Blob.as_legacy_object)
        Blob.as_legacy_object = as_legacy_object_error
        list(get_loose_object(self._req, backend, mat))
        self.assertEqual(HTTP_ERROR, self._status)
コード例 #7
0
    def test_get_loose_object_error(self):
        blob = make_object(Blob, data=b'foo')
        backend = _test_backend([blob])
        mat = re.search('^(..)(.{38})$', blob.id.decode('ascii'))

        def as_legacy_object_error(self):
            raise IOError

        self.addCleanup(
            setattr, Blob, 'as_legacy_object', Blob.as_legacy_object)
        Blob.as_legacy_object = as_legacy_object_error
        list(get_loose_object(self._req, backend, mat))
        self.assertEqual(HTTP_ERROR, self._status)
コード例 #8
0
ファイル: test_web.py プロジェクト: Reidsy/AppengineGit
 def test_get_loose_object_missing(self):
     mat = re.search('^(..)(.{38})$', '1' * 40)
     list(get_loose_object(self._req, _test_backend([]), mat))
     self.assertEquals(HTTP_NOT_FOUND, self._status)
コード例 #9
0
ファイル: test_web.py プロジェクト: kankri/dulwich
 def test_get_loose_object_missing(self):
     mat = re.search('^(..)(.{38})$', '1' * 40)
     list(get_loose_object(self._req, _test_backend([]), mat))
     self.assertEquals(HTTP_NOT_FOUND, self._status)