diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..8149664 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,28 @@ +name: "Test Suite" +on: + push: + pull_request: + +jobs: + test: + name: cargo test + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - run: cargo test --all-features + + formatting: + name: cargo fmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 diff --git a/baffao-core/src/oauth/client.rs b/baffao-core/src/oauth/client.rs index 3c3f4fb..e037a4a 100644 --- a/baffao-core/src/oauth/client.rs +++ b/baffao-core/src/oauth/client.rs @@ -2,7 +2,9 @@ use std::time::Duration; use anyhow::Context; use oauth2::{ - basic::{BasicClient, BasicTokenType}, reqwest::async_http_client, AccessToken, AuthType, AuthUrl, AuthorizationCode, ClientId, ClientSecret, CsrfToken, RedirectUrl, RefreshToken, Scope, StandardErrorResponse, TokenResponse, TokenUrl + basic::BasicClient, reqwest::async_http_client, AccessToken, AuthType, AuthUrl, + AuthorizationCode, ClientId, ClientSecret, CsrfToken, RedirectUrl, RefreshToken, Scope, + TokenResponse, TokenUrl, }; use reqwest::Url; @@ -58,12 +60,17 @@ impl OAuthClient { } let code = AuthorizationCode::new(code); - let token = self.client + let token = self + .client .exchange_code(code) .request_async(async_http_client) .await .context("Failed to exchange code")?; - Ok((token.access_token().clone(), token.refresh_token().cloned(), token.expires_in())) + Ok(( + token.access_token().clone(), + token.refresh_token().cloned(), + token.expires_in(), + )) } }