This repository has been archived by the owner on Feb 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from jennybc/get-via-csv-fix
Add param to check if sheet is public before making req
- Loading branch information
Showing
15 changed files
with
140 additions
and
27 deletions.
There are no files selected for viewing
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,7 +1,7 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.httr-oauth | ||
.httr-oauth* | ||
googlesheets.Rproj | ||
jenny-scratch/* | ||
tests/testthat/googlesheets_token.rds |
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' --- | ||
#' output: md_document | ||
#' --- | ||
|
||
library("googlesheets") | ||
suppressPackageStartupMessages(library("dplyr")) | ||
|
||
## damn you render and your hard-wiring of wd = dir where file lives! | ||
## if I don't commit this abomination, existing .httr-oauth cannot be found :( | ||
if ((getwd() %>% basename) == "data-for-demo") { | ||
setwd("..") | ||
} | ||
|
||
cars_ss <- gs_new("test-gs-cars-private", ws_title = "cars", | ||
input = head(mtcars), header = TRUE, trim = TRUE) | ||
cars_ss |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
% Generated by roxygen2 (4.1.1): do not edit by hand | ||
% Please edit documentation in R/gs_auth.R | ||
\name{gs_auth_revoke} | ||
\alias{gs_auth_revoke} | ||
\title{Revoke authentication} | ||
\usage{ | ||
gs_auth_revoke(rm_httr_oauth = FALSE, verbose = TRUE) | ||
} | ||
\description{ | ||
This unexported function exists so we can revoke all authentication for | ||
testing purposes. | ||
} | ||
\keyword{internal} | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
context("revoke authentication") | ||
|
||
## remove the google token, to make 100% sure the remaining tests run w/o auth | ||
|
||
## this filename is deliberate w/r/t alphabetical order, so don't change it | ||
## lightly! it's no coincidence that "axe" starts with "A" | ||
gs_auth_revoke(rm_httr_oauth = TRUE, verbose = FALSE) | ||
|
||
test_that("Token does NOT exist, no .httr-oauth file in wd", { | ||
|
||
expect_false(token_exists()) | ||
expect_false(file.exists(".httr-oauth")) | ||
|
||
}) | ||
|
||
test_that("We can NOT register a pvt sheet owned by rpackagetest", { | ||
|
||
if(interactive()) { | ||
mess <- paste("Skipping the attempt to access private third party", | ||
"sheet w/o authorization, because session is interactive", | ||
"and would launch browser-based authentication.") | ||
skip(mess) | ||
} | ||
expect_error(gs_ws_feed(cars_pvt_ws_feed, lookup = FALSE, verbose = FALSE)) | ||
|
||
}) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 +1,9 @@ | ||
## re-authenticate! | ||
gs_auth(token = "googlesheets_token.rds") | ||
|
||
## "RAIN DANCE" | ||
## RELIABLY FORCES AUTO-REFRESH OF STALE OAUTH TOKEN | ||
## I DON'T KNOW WHY THIS HELPS BUT IT DOES! | ||
gs_ls() | ||
|
||
gs_grepdel(TEST, verbose = FALSE) |