Example #1
0
    def test_get_path_of_file(self):
        metadata = {
            "name": "hello.jpg",
            "path_collection": {
                "total_count": 2,
                "entries": [
                    {"type": "folder", "id": "0", "name": "All Files"},
                    {"type": "folder", "id": "11446498", "sequence_id": "1", "etag": "1", "name": "Pictures"},
                ],
            },
        }

        self.assertEqual("/Pictures/hello.jpg", BoxClient.get_path_of_file(metadata))

        metadata = {
            "name": "hello.jpg",
            "path_collection": {"total_count": 2, "entries": [{"type": "folder", "id": "0", "name": "All Files"}]},
        }

        self.assertEqual("/hello.jpg", BoxClient.get_path_of_file(metadata))
Example #2
0
    def test_get_path_of_file(self):
        metadata = {
            "name": "hello.jpg",
            "path_collection": {
                "total_count": 2,
                "entries": [
                    {
                        "type": "folder",
                        "id": "0",
                        "name": "All Files"
                    },
                    {
                        "type": "folder",
                        "id": "11446498",
                        "sequence_id": "1",
                        "etag": "1",
                        "name": "Pictures"
                    }
                ]
            }
        }

        self.assertEqual('/Pictures/hello.jpg', BoxClient.get_path_of_file(metadata))

        metadata = {
            "name": "hello.jpg",
            "path_collection": {
                "total_count": 2,
                "entries": [
                    {
                        "type": "folder",
                        "id": "0",
                        "name": "All Files"
                    },
                ]
            }
        }

        self.assertEqual('/hello.jpg', BoxClient.get_path_of_file(metadata))