예제 #1
0
    def setUp(self):
        super(BaseViewTestCase, self).setUp()
        self.storage = storage.GitStorage(self.location)

        if self.path is None:
            raise ValueError("Forgot to declare a path!")

        self.path = Path(self.path)
        self.user = factories.UserFactory(password="******")
        self.client.login(username=self.user.username, password="******")

        git_obj = self.storage.repository.open(self.path)

        if git_obj.type == pygit2.GIT_OBJ_BLOB:
            self.blob = git_obj

            # Permission to parent path
            parent = Path(self.path.parent_path)
            self.permission = factories.TreePermissionFactory(
                parent_path=parent.parent_path, name=parent.name, user=self.user
            )

            # Blob metadata
            self.metadata = factories.BlobMetadataFactory(id=self.blob.hex, mimetype="text/plain")

        elif git_obj.type == pygit2.GIT_OBJ_TREE:
            self.tree = git_obj

            # Permission to itself
            factories.TreePermissionFactory(parent_path=self.path.parent_path, name=self.path.name, user=self.user)
예제 #2
0
 def setUp(self):
     super(TreeViewTestCase, self).setUp()
     # A blob found in the path
     self.blob = self.storage.repository.open("foo/bar/baz/qux.txt")
     self.blob_metadata = factories.BlobMetadataFactory(id=self.blob.hex)
예제 #3
0
 def setUp(self):
     super(AdminPermissionTestCase, self).setUp()
     # A blob found at the root
     self.blob = self.storage.repository.open("foo.txt")
     self.blob_metadata = factories.BlobMetadataFactory(id=self.blob.hex)
예제 #4
0
 def setUp(self):
     self.metadata = factories.BlobMetadataFactory(id="c0d11342c4241087e3c126f7666d618586e39068",
                                                   mimetype="image/jpeg")