fix tests

This commit is contained in:
2020-01-07 00:46:12 +08:00
parent 86deb61ba0
commit 24e0c968ee
3 changed files with 8 additions and 1 deletions

View File

@@ -16,3 +16,6 @@ reqwest = "0.10.0"
urlencoding = "1.0.0"
json = "0.12.0"
futures = "0.3.1"
[dev-dependencies]
tokio-test = "0.2.0"

View File

@@ -9,6 +9,8 @@ NOTE: From version 1.1.0 dingtalk uses reqwest 0.10.0's async/await API.
Sample 1:
```rust
use dingtalk::DingTalk;
#[tokio::main]
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
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):
```rust
#[tokio::main]

View File

@@ -497,7 +497,7 @@ fn calc_hmac_sha256(key: &[u8], message: &[u8]) -> MacResult {
#[test]
fn run_all_tests() {
futures::executor::block_on(_test_send()).unwrap();
tokio_test::block_on(_test_send()).unwrap();
}
async fn _test_send() -> XResult<()> {