fix tests
This commit is contained in:
@@ -16,3 +16,6 @@ reqwest = "0.10.0"
|
|||||||
urlencoding = "1.0.0"
|
urlencoding = "1.0.0"
|
||||||
json = "0.12.0"
|
json = "0.12.0"
|
||||||
futures = "0.3.1"
|
futures = "0.3.1"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
tokio-test = "0.2.0"
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ NOTE: From version 1.1.0 dingtalk uses reqwest 0.10.0's async/await API.
|
|||||||
|
|
||||||
Sample 1:
|
Sample 1:
|
||||||
```rust
|
```rust
|
||||||
|
use dingtalk::DingTalk;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let dt = DingTalk::new("<token>", "");
|
let dt = DingTalk::new("<token>", "");
|
||||||
@@ -18,6 +20,8 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Need use crate: `tokio = { version = "0.2.6", features = ["full"] }`.
|
||||||
|
|
||||||
Sample 2 (Read token from file):
|
Sample 2 (Read token from file):
|
||||||
```rust
|
```rust
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ fn calc_hmac_sha256(key: &[u8], message: &[u8]) -> MacResult {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn run_all_tests() {
|
fn run_all_tests() {
|
||||||
futures::executor::block_on(_test_send()).unwrap();
|
tokio_test::block_on(_test_send()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn _test_send() -> XResult<()> {
|
async fn _test_send() -> XResult<()> {
|
||||||
|
|||||||
Reference in New Issue
Block a user