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

Check api functions to increase Code Coverage #6

Merged
merged 8 commits into from
Jun 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions tests/fixtures/check_api_version.yml

This file was deleted.

39 changes: 0 additions & 39 deletions tests/fixtures/check_authentication.yml

This file was deleted.

14 changes: 7 additions & 7 deletions tests/fixtures/check_last_audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ http_interactions:
string: ''
headers:
Accept: application/json, text/xml, application/xml, */*
Authorization: My bearer token is safe
X-BUGZILLA-API-KEY: Removing this header too just in case
response:
status:
status_code: 200
category: Success
reason: OK
message: 'Success: (200) OK'
headers:
date: Mon, 31 May 2021 03:04:29 GMT
date: Sat, 12 Jun 2021 22:38:08 GMT
server: gazelle
etag: GIrwjX1k17GX4FOvl+NcVA
etag: /kF0g2q98GJLV5YGfBdm7Q
content-length: '42'
content-type: application/json; charset=UTF-8
access-control-allow-headers: accept, content-type, origin, user-agent, x-requested-with,
x-bugzilla-login, x-bugzilla-password, x-bugzilla-token, x-bugzilla-api-key
x-bugzilla-api-key, x-bugzilla-login, x-bugzilla-token, x-bugzilla-password
access-control-allow-origin: '*'
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
set-cookie: Bugzilla_login_request_cookie=l0ZOvJZzmk; domain=bugs.r-project.org;
path=/bugzilla/; secure; HttpOnly
body:
encoding: UTF-8
file: no
string: '{"last_audit_time":"2021-05-27T01:19:10Z"}'
recorded_at: 2021-05-31 03:04:28 GMT
string: '{"last_audit_time":"2021-06-09T23:47:55Z"}'
recorded_at: 2021-06-12 22:38:08 GMT
recorded_with: vcr/0.6.0, webmockr/0.8.0
74 changes: 0 additions & 74 deletions tests/fixtures/create_bugzilla_key.yml

This file was deleted.

1 change: 0 additions & 1 deletion tests/fixtures/params.yml

This file was deleted.

1 change: 0 additions & 1 deletion tests/fixtures/valid_key.yml

This file was deleted.

132 changes: 56 additions & 76 deletions tests/testthat/_snaps/api.md
Original file line number Diff line number Diff line change
@@ -1,118 +1,98 @@
# cli_alert_warning [plain]
# create_bugzilla_key() works [plain]

Code
cli::cli_alert_warning(
"This package hasn't been tested with this Bugzilla version.")
create_bugzilla_key(host = missing_host())
Message <cliMessage>
! This package hasn't been tested with this Bugzilla version.

# cli_alert_warning [ansi]

Code
cli::cli_alert_warning(
"This package hasn't been tested with this Bugzilla version.")
Message <cliMessage>
! This package hasn't been tested with this Bugzilla version.

# cli_alert_warning [unicode]

Code
cli::cli_alert_warning(
"This package hasn't been tested with this Bugzilla version.")
Message <cliMessage>
! This package hasn't been tested with this Bugzilla version.
i Reading cached keys on '/home/data/.cache/R/bugRzilla/.Renviron'.
v Found key `R_BUGZILLA`.
v Using key `R_BUGZILLA`.
x Not authenticated on this site.
v Authenticated on this site!

# cli_alert_warning [fancy]
# create_bugzilla_key() works [unicode]

Code
cli::cli_alert_warning(
"This package hasn't been tested with this Bugzilla version.")
create_bugzilla_key(host = missing_host())
Message <cliMessage>
! This package hasn't been tested with this Bugzilla version.
ℹ Reading cached keys on '/home/data/.cache/R/bugRzilla/.Renviron'.
✔ Found key `R_BUGZILLA`.
✔ Using key `R_BUGZILLA`.
✖ Not authenticated on this site.
✔ Authenticated on this site!

# ul [plain]
# check_key() works [plain]

Code
cli::cli_ul("Create the API key on the website.")
check_key(key_name = missing_key(), verbose = TRUE)
Message <cliMessage>
* Create the API key on the website.
i Reading cached keys on '/home/data/.cache/R/bugRzilla/.Renviron'.
v Found key `R_BUGZILLA`.
Output
[1] TRUE

# ul [unicode]
# check_key() works [unicode]

Code
cli::cli_ul("Create the API key on the website.")
check_key(key_name = missing_key(), verbose = TRUE)
Message <cliMessage>
• Create the API key on the website.
ℹ Reading cached keys on '/home/data/.cache/R/bugRzilla/.Renviron'.
✔ Found key `R_BUGZILLA`.
Output
[1] TRUE

# ca_cli_alert_danger [plain]
# use_key() works [plain]

Code
cli::cli_alert_danger("Not authenticated on this site.")
Message <cliMessage>
x Not authenticated on this site.
Code
cli::cli_alert_success("Authenticated on this site!")
use_key(missing_key())
Message <cliMessage>
v Authenticated on this site!
v Using key `R_BUGZILLA`.

# ca_cli_alert_danger [ansi]
---

Code
cli::cli_alert_danger("Not authenticated on this site.")
Message <cliMessage>
x Not authenticated on this site.
Code
cli::cli_alert_success("Authenticated on this site!")
Message <cliMessage>
v Authenticated on this site!
!check_key(key_name = missing_key(), verbose = FALSE)
Output
[1] FALSE

# ca_cli_alert_danger [unicode]
# use_key() works [unicode]

Code
cli::cli_alert_danger("Not authenticated on this site.")
use_key(missing_key())
Message <cliMessage>
✖ Not authenticated on this site.
Code
cli::cli_alert_success("Authenticated on this site!")
Message <cliMessage>
✔ Authenticated on this site!
✔ Using key `R_BUGZILLA`.

# ca_cli_alert_danger [fancy]
---

Code
cli::cli_alert_danger("Not authenticated on this site.")
Message <cliMessage>
✖ Not authenticated on this site.
Code
cli::cli_alert_success("Authenticated on this site!")
Message <cliMessage>
✔ Authenticated on this site!
!check_key(key_name = missing_key(), verbose = FALSE)
Output
[1] FALSE

# vk_cli_alert_danger [plain]
# valid_key() works [plain]

Code
cli::cli_alert_danger("Key not valid or not set.")
Message <cliMessage>
x Key not valid or not set.
valid_key(key = missing_key())
Output
[1] TRUE

# vk_cli_alert_danger [ansi]
# valid_key() works [ansi]

Code
cli::cli_alert_danger("Key not valid or not set.")
Message <cliMessage>
x Key not valid or not set.
valid_key(key = missing_key())
Output
[1] TRUE

# vk_cli_alert_danger [unicode]
# valid_key() works [unicode]

Code
cli::cli_alert_danger("Key not valid or not set.")
Message <cliMessage>
✖ Key not valid or not set.
valid_key(key = missing_key())
Output
[1] TRUE

# vk_cli_alert_danger [fancy]
# valid_key() works [fancy]

Code
cli::cli_alert_danger("Key not valid or not set.")
Message <cliMessage>
✖ Key not valid or not set.
valid_key(key = missing_key())
Output
[1] TRUE

Loading