コード例 #1
0
ファイル: test_app.py プロジェクト: pombredanne/picture_clerk
    def test_init(self):
        path = "/test/path"
        rep = app.init_repo(path)

        self.assertEqual(rep.connector.url.path, path)
        self.assertEqual(rep.index, index.PictureIndex())
        self.assertEqual(rep.config, repo.new_repo_config())
コード例 #2
0
 def setUp(self):
     self.connector = MockConnector(urlparse.urlparse('/baseurl/repo/'))
     self.connector.connect()
     self.pi = index.PictureIndex()
     self.pi.add(MockPicture.create_many(10))
     self.conf = repo.new_repo_config()
     self.conf['index.file'] = 'mock-index-path'
コード例 #3
0
ファイル: test_repo.py プロジェクト: irvpriddy/picture_clerk
 def setUp(self):
     self.connector = MockConnector(urlparse.urlparse('/baseurl/repo/'))
     self.connector.connect()
     self.pi = index.PictureIndex()
     self.pi.add(MockPicture.create_many(10))
     self.conf = repo.new_repo_config()
     self.conf['index.file'] = 'mock-index-path'
コード例 #4
0
ファイル: app.py プロジェクト: pombredanne/picture_clerk
def init_repo(url):
    """
    Initialize a new repository and return it.
    
    Arguments:
    url -- URL of the repository to be initialized (e.g. '/home/user/repo').
    
    Returns:
    The initialized repository.
    """
    config = repo.new_repo_config()
    connector = Connector.from_string(url)
    with connector.connected():
        rep = repo.Repo.create_on_disk(connector, config)
    init_repo_logging(rep)
    log.info("Initialized empty PictureClerk repository")
    return rep
コード例 #5
0
ファイル: testlib.py プロジェクト: irvpriddy/picture_clerk
def new_mock_repo(path, num_pics=0):
    """
    Return a repository containing MockPictures using MockConnector backend.
    
    Arguments:
    num_pics -- Add that many MockPictures to the repository index (default: 0).
    
    Returns:
    Repository instance.
    """

    connector = MockConnector.from_string(path)
    with connector.connected():
        # test index
        pi = PictureIndex()
        pi.add(MockPicture.create_many(num_pics))

        # test config
        conf = repo.new_repo_config()
        conf['index.file'] = ".pic/testindex"
        conf['test.test'] = "foo"

        return repo.Repo.create_on_disk(connector, conf, pi)
コード例 #6
0
ファイル: testlib.py プロジェクト: pombredanne/picture_clerk
def new_mock_repo(path, num_pics=0):
    """
    Return a repository containing MockPictures using MockConnector backend.
    
    Arguments:
    num_pics -- Add that many MockPictures to the repository index (default: 0).
    
    Returns:
    Repository instance.
    """

    connector = MockConnector.from_string(path)
    with connector.connected():
        # test index
        pi = PictureIndex()
        pi.add(MockPicture.create_many(num_pics))

        # test config
        conf = repo.new_repo_config()
        conf['index.file'] = ".pic/testindex"
        conf['test.test'] = "foo"

        return repo.Repo.create_on_disk(connector, conf, pi)