()
| 5 | |
| 6 | |
| 7 | def test_user(): |
| 8 | if not credentials_available(): |
| 9 | warnings.warn("Skipped test_user because there were no credentials available.") |
| 10 | return |
| 11 | sess = session() |
| 12 | |
| 13 | user = sess.connect_user("faretek1") |
| 14 | assert "mochipiyo" in user.unfollower_usernames() |
| 15 | |
| 16 | user = sess.connect_user("ScratchAttachV2") |
| 17 | |
| 18 | assert user.id == 147905216 |
| 19 | assert user.username == "ScratchAttachV2" |
| 20 | assert user.name == "ScratchAttachV2" |
| 21 | assert "Literally a 'test'" in user.about_me |
| 22 | assert "Changes here must be careful" in user.wiwo |
| 23 | assert user.country == "Germany" |
| 24 | assert not user.is_new_scratcher() |
| 25 | assert user.rank() == sa.Rank.SCRATCHER |
| 26 | assert not user.scratchteam |
| 27 | assert user.join_date == "2024-12-09T19:58:44.000Z" |
| 28 | assert user.classroom is None |
| 29 | assert user.does_exist() |
| 30 | |
| 31 | new_scratcher = sess.connect_user("-NewScratcher-") |
| 32 | assert new_scratcher.is_new_scratcher() |
| 33 | assert new_scratcher.rank() == sa.Rank.NEW_SCRATCHER |
| 34 | assert not new_scratcher.scratchteam |
| 35 | |
| 36 | ceebee = sess.connect_user("ceebee") |
| 37 | assert not ceebee.is_new_scratcher() |
| 38 | assert ceebee.scratchteam |
| 39 | assert ceebee.rank() == sa.Rank.SCRATCH_TEAM |
| 40 | |
| 41 | kaj = sess.connect_user("kaj") |
| 42 | assert not kaj.does_exist() |
| 43 | # If you request for a user that never existed using sa.get_user, you will get an error. So we construct a new user |
| 44 | # here like so: |
| 45 | assert not sa.User(username="_").does_exist() |
| 46 | |
| 47 | # status, bio |
| 48 | # If the following is not the case, then a miracle has occurred |
| 49 | griffpatch = sess.connect_user("griffpatch") |
| 50 | assert griffpatch.message_count() > 100 |
| 51 | |
| 52 | assert user.featured_data() is None |
| 53 | assert ceebee.featured_data() |
| 54 | |
| 55 | assert griffpatch.follower_count() > 100000 |
| 56 | assert user.following_count() > 5 |
| 57 | assert kaj.followers(limit=1)[0].name == "DarkLava" |
| 58 | assert kaj.follower_names(limit=1)[0] == "DarkLava" |
| 59 | assert user.following(offset=user.following_count() - 1, limit=1)[0].name == "TimMcCool" |
| 60 | assert user.is_following("TimMcCool") |
| 61 | assert kaj.is_followed_by("DarkLava") |
| 62 | assert griffpatch.project_count() > 15 |
| 63 | user_studio_count = user.studio_count() |
| 64 | assert user_studio_count > 0 |
no test coverage detected