()
| 91 | |
| 92 | |
| 93 | def test_parse_embedded_folder_view() -> None: |
| 94 | html_file = osp.join(here, "data/embedded-folder-view-sample.html") |
| 95 | with open(html_file) as f: |
| 96 | content = f.read() |
| 97 | |
| 98 | mock_response = unittest.mock.Mock() |
| 99 | mock_response.status_code = 200 |
| 100 | mock_response.text = content |
| 101 | |
| 102 | mock_sess = unittest.mock.Mock() |
| 103 | mock_sess.get.return_value = mock_response |
| 104 | |
| 105 | result = _parse_embedded_folder_view(sess=mock_sess, folder_id="test_folder_id") |
| 106 | |
| 107 | assert result is not None |
| 108 | folder_name, children = result |
| 109 | assert folder_name == "files_100" |
| 110 | assert len(children) == 4 |
| 111 | |
| 112 | ids = [r[0] for r in children] |
| 113 | names = [r[1] for r in children] |
| 114 | types = [r[2] for r in children] |
| 115 | |
| 116 | assert ids == [ |
| 117 | "108RHF3bQb6dgOByv_KMGzHuktJOwU_jL", |
| 118 | "1Sul7bhaimPjncS2GE73nVloSPQbtyzu-", |
| 119 | "1xYz2AbCdEfGhIjKlMnOpQrStUvWxYz3A", |
| 120 | "1aMZqPaU03E7XOQNXtjSCdguRHBaIQ82m", |
| 121 | ] |
| 122 | assert names == ["file_00.txt", "file_01.txt", "photo.jpg", "subfolder"] |
| 123 | assert types == [ |
| 124 | "application/octet-stream", |
| 125 | "application/octet-stream", |
| 126 | "application/octet-stream", |
| 127 | _GoogleDriveFile.TYPE_FOLDER, |
| 128 | ] |
| 129 | |
| 130 | |
| 131 | def test_parse_embedded_folder_view_http_error() -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…