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

Add serde_urlencoded to db-example Cargo.toml #128

Merged
merged 5 commits into from Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .cirrus.yml
Expand Up @@ -12,6 +12,9 @@ stable_task:
- CRATE: actix-example
- CRATE: oxide-auth-iron
- CRATE: oxide-auth-rouille
- CRATE: oxide-auth-db
OXIDE_AUTH_SKIP_REDIS: yes
- CRATE: db-example
build_script: cargo build -p "$CRATE" --examples
test_script: cargo test -p "$CRATE"
before_cache_script: rm -rf $CARGO_HOME/registry/index
Expand All @@ -31,6 +34,9 @@ nightly_task:
- CRATE: oxide-auth-iron
- CRATE: oxide-auth-rouille
- CRATE: oxide-auth-rocket
- CRATE: oxide-auth-db
OXIDE_AUTH_SKIP_REDIS: yes
- CRATE: db-example
build_script: cargo build -p "$CRATE" --examples
test_script: cargo test -p "$CRATE"
before_cache_script: rm -rf $CARGO_HOME/registry/index
Expand Down
6 changes: 3 additions & 3 deletions oxide-auth-db/examples/db-example/Cargo.toml
@@ -1,11 +1,10 @@
[package]
name = "db-example"
version = "0.1.0"
version = "0.0.0"
authors = ["liujing <liujingb@mail.taiji.com.cn>"]
edition = "2018"
license = "MIT OR Apache-2.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
publish = false

[dependencies]
oxide-auth = { version = "0.5.0-preview.0", path = "../../../oxide-auth" }
Expand All @@ -19,6 +18,7 @@ futures = "0.3"
reqwest = "=0.9.5"
serde = "1.0"
serde_json = "1.0"
serde_urlencoded = "^0.7"
url = "2"
anyhow = "1.0"
r2d2_redis = {version = "0.13"}
Expand Down
11 changes: 11 additions & 0 deletions oxide-auth-db/src/lib.rs
Expand Up @@ -3,3 +3,14 @@ extern crate serde_derive;

pub mod db_service;
pub mod primitives;

#[cfg(test)]
fn requires_redis_and_should_skip() -> bool {
match std::env::var("OXIDE_AUTH_SKIP_REDIS") {
Err(_) => false,
Ok(st) => match st.as_str() {
"1" | "yes" => true,
_ => false,
},
}
}
8 changes: 8 additions & 0 deletions oxide-auth-db/src/primitives/db_registrar.rs
Expand Up @@ -177,6 +177,10 @@ mod tests {

#[test]
fn with_additional_redirect_uris() {
if crate::requires_redis_and_should_skip() {
return;
}

let client_id = "ClientId";
let redirect_uri =
RegisteredUrl::from(ExactUrl::new("https://example.com/foo".parse().unwrap()).unwrap());
Expand Down Expand Up @@ -230,6 +234,10 @@ mod tests {

#[test]
fn client_service() {
if crate::requires_redis_and_should_skip() {
return;
}

let mut oauth_service = DBRegistrar::new(
"redis://localhost/3".parse().unwrap(),
32,
Expand Down