-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix get_events() unit test and add case to find_groups()
* get_events now tests the get_events call * added TODO's for future tests based on logical branches * find_groups now runs with and without optional params Part of Issue #31
- Loading branch information
1 parent
d67e66b
commit bbfc85c
Showing
4 changed files
with
42 additions
and
17 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,25 @@ | ||
context("get_events") | ||
|
||
test_that(".quick_fetch() works properly", { | ||
skip_on_travis() | ||
skip_on_cran() | ||
api_key <- Sys.getenv("MEETUP_KEY") | ||
event_status <- "past" | ||
urlname <- Sys.getenv("MEETUP_NAME") | ||
meetup_api_prefix <- "https://api.meetup.com/" | ||
api_url <- paste0(meetup_api_prefix, urlname, "/events") | ||
test_that("get_events() success case", { | ||
meetup_events <- with_mock( | ||
`httr::GET` = function(url, query, ...) { | ||
print(getwd()) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
load(here::here("tests/testdata/httr_get_get_events.rda")) | ||
return(req) | ||
}, | ||
meetup_events <- get_events(api_key="yay", | ||
urlname = "<3", | ||
event_status = "upcoming") | ||
) | ||
|
||
res <- .quick_fetch(api_url = api_url, | ||
api_key = api_key, | ||
event_status = event_status) | ||
total_records <- as.integer(res$headers$`x-total-count`) | ||
length_results <- length(res$result) | ||
expect_equal(total_records,length_results) | ||
expect_equal(nrow(meetup_events), 1, label="check get_events() returns one result") | ||
expect_equal(meetup_events$status, "upcoming", label="check get_events() content (status)") | ||
}) | ||
|
||
# TODO: multiple statuses | ||
|
||
# TODO: event type is not allowed | ||
|
||
# TODO: "urlname is missing" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Whoops, left some debug code.