()
| 5 | |
| 6 | |
| 7 | def test_studio(): |
| 8 | if not credentials_available(): |
| 9 | warnings.warn("Skipped test_studio because there were no credentials available.") |
| 10 | return |
| 11 | sess = session() |
| 12 | |
| 13 | studio = sess.connect_studio(247962) |
| 14 | assert studio.get_exact_project_count() > 100000 |
| 15 | |
| 16 | studio = sess.connect_studio(50809872) |
| 17 | |
| 18 | assert studio.title == "Sample studio" |
| 19 | assert studio.description == "Sample text" |
| 20 | assert studio.host_id == 147905216 |
| 21 | assert studio.open_to_all is False |
| 22 | assert studio.comments_allowed is False |
| 23 | assert studio.image_url == "https://cdn2.scratch.mit.edu/get_image/gallery/50809872_170x100.png" |
| 24 | assert datetime.fromisoformat(studio.created) == datetime(2025, 8, 26, 15, 3, 5, tzinfo=timezone.utc) |
| 25 | assert studio.follower_count > 0 |
| 26 | assert 0 < studio.manager_count <= 2 |
| 27 | assert studio.project_count == 2 |
| 28 | |
| 29 | # (un)follow |
| 30 | |
| 31 | comment = studio.comments()[0] |
| 32 | assert comment.content == "Sample" |
| 33 | assert comment.id == 302129887 |
| 34 | assert comment.author_name == "faretek1" |
| 35 | assert comment.replies()[0].content == "text" |
| 36 | |
| 37 | # comment replies, comment by id, post comment, delete comment, report comment, set thumb, reply comment |
| 38 | projs = studio.projects() |
| 39 | assert len(projs) == 2 |
| 40 | assert projs[0].title == "Sample remix" |
| 41 | assert projs[1].title == "Sample project #1" |
| 42 | |
| 43 | role = studio.your_role() |
| 44 | assert role["manager"] |
| 45 | assert role["following"] |
| 46 | |
| 47 | curator_names = [curator.name for curator in studio.managers()] |
| 48 | assert "ScratchAttachV2" in curator_names |
| 49 | |
| 50 | assert not studio.curators() |
| 51 | |
| 52 | # invite/promote/remove curators transfer ownership / leave / add project / remove proj |
| 53 | |
| 54 | host = studio.host() |
| 55 | assert host.name == "ScratchAttachV2" |
| 56 | |
| 57 | # set fields, desc, title, open projects, close projects, turn on/off/toggle commenting |
| 58 | assert studio.activity()[2].type == sa.ActivityTypes.addprojecttostudio |
| 59 | # accept invite/your role |
| 60 | |
| 61 | # If we run out of 'add everything!' studios, clearly something has gone wrong. |
| 62 | assert sa.search_studios(query="add everything!") |
| 63 | assert sa.explore_studios(query="*") |
| 64 |
no test coverage detected