Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples and tests #19

Closed
schochastics opened this issue Nov 7, 2022 · 10 comments
Closed

examples and tests #19

schochastics opened this issue Nov 7, 2022 · 10 comments
Assignees
Milestone

Comments

@schochastics
Copy link
Member

Probably need to learn from rtweet how to properly setup unit testing and examples. Suggestions welcome

@chainsawriot
Copy link
Collaborator

@chainsawriot chainsawriot self-assigned this Nov 7, 2022
@chainsawriot
Copy link
Collaborator

chainsawriot commented Nov 7, 2022

For rtweet, vcr is used. It also looks easier to use than httptest. Maybe we should use vcr instead.

Edited: I'm gonna test both.

@chainsawriot
Copy link
Collaborator

chainsawriot commented Nov 8, 2022

  • CI
  • Test Coverage

@chainsawriot
Copy link
Collaborator

chainsawriot commented Nov 8, 2022

Test cases for
timelines_statuses.R

  • get_status
  • get_reblogged_by
  • get_favourited_by
  • get_context
  • get_poll
  • get_public_timeline
  • get_hashtag_timeline
  • get_home_timeline
  • get_list_timeline

accounts.R

  • get_account
  • search_accounts
  • get_account_statuses
  • get_account_followers
  • get_account_following
  • get_account_featured_tags
  • get_account_lists
  • get_account_relationships
  • get_account_bookmarks
  • get_account_favourites
  • get_account_blocks
  • get_account_mutes

post.R

  • post_toot
  • post_user

instances.R

  • get_fedi_instances
  • get_instance_general
  • get_instance_peers
  • get_instance_activity
  • get_instance_emoji
  • get_instance_directory
  • get_instance_trends

auth.R

  • auth_setup (Interactive, maybe leave it for later)
  • verify_credentials

Priority will be given to the ones using make_get_request to facilitate #31

@chainsawriot
Copy link
Collaborator

Data structure testing

  • accounts

@schochastics
Copy link
Member Author

schochastics commented Nov 9, 2022

anything I need to setup so test work? I get the following error for all account level tests:

Error (test-get_account_auth.R:12:3): get_account_followers
Error: 

================================================================================
An HTTP request has been made that vcr does not know how to handle:
GET https://fosstodon.org/api/v1/accounts/109281650341067731/followers?limit=3
vcr is currently using the following cassette:
  - /home/david/Documents/R/rtoot/tests/fixtures/get_account_followers_default.yml
    - record_mode: once
    - match_requests_on: method, uri
Set `VCR_VERBOSE_ERRORS=TRUE` for more verbose errors
If you're not sure what to do, open an issue https://github.com/ropensci/vcr/issues
& see https://books.ropensci.org/http-testing
================================================================================
Backtrace:
  1. vcr::use_cassette(...)
       at test-get_account_auth.R:12:2
  3. rtoot::get_account_followers(id = id, limit = 3)
       at test-get_account_auth.R:13:4
  4. rtoot:::process_request(...)
       at rtoot/R/accounts.R:86:2
  5. rtoot:::make_get_request(...)
       at rtoot/R/utils.R:84:2
  6. httr::GET(httr::modify_url(url, path = path), config, query = params)
       at rtoot/R/utils.R:32:2
  7. httr:::request_perform(req, hu$handle$handle)
  8. httr:::perform_callback("request", req = req)
  9. webmockr (local) callback(...)
 10. webmockr::HttrAdapter$new()$handle_request(req)
 11. private$request_handler(req)$handle()
 12. eval(parse(text = req_type_fun))(self$request)
 13. err$run()
 14. self$construct_message()

Edit:

[ FAIL 21 | WARN 0 | SKIP 0 | PASS 83 ]

@chainsawriot
Copy link
Collaborator

chainsawriot commented Nov 9, 2022 via email

@schochastics
Copy link
Member Author

sounds good. Probably gonna have a PR somewhen tonight

@chainsawriot
Copy link
Collaborator

With this, maybe we should setup CI now.

@schochastics
Copy link
Member Author

yep gonna set it up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants