Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <[email protected]>
  • Loading branch information
simonsan committed Nov 14, 2024
1 parent 87db902 commit e59acd5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
22 changes: 22 additions & 0 deletions maskfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,3 +408,25 @@ PowerShell:
```powershell
hurl -i tests/fixtures/hurl/endpoints.hurl
```

## debug-test (test)

> Run a single test with debug output
- test
- flags: -t, --test
- type: string
- desc: Only run the specified test target
- required

Bash:

```bash
$env:RUST_LOG="debug"; cargo test --package rustic_server --lib -- $test --exact --nocapture --show-output
```

PowerShell:

```powershell
$env:RUST_LOG="debug"; cargo test --package rustic_server --lib -- $test --exact --nocapture --show-output
```
4 changes: 2 additions & 2 deletions src/handlers/file_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ mod test {
// -----------------------
// Create a new repository
// -----------------------
let repo_name_uri = ["/", &repo, "?create=true"].concat();
let repo_name_uri = ["/", &repo, "/", "?create=true"].concat();
let app = Router::new()
.typed_post(create_repository::<RepositoryPath>)
.layer(middleware::from_fn(print_request_response));
Expand Down Expand Up @@ -307,7 +307,7 @@ mod test {
// -----------------------
// CLEAN UP DELETE REPO
// -----------------------
let repo_name_uri = ["/", &repo].concat();
let repo_name_uri = ["/", &repo, "/"].concat();
let app = Router::new()
.typed_delete(delete_repository::<RepositoryPath>)
.layer(middleware::from_fn(print_request_response));
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/files_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ mod test {
.layer(middleware::from_fn(print_request_response));

let request = Request::builder()
.uri("/test_repo/keys")
.uri("/test_repo/keys/")
.header(ACCEPT, ApiVersionKind::V1.to_static_str())
.header(
"Authorization",
Expand Down Expand Up @@ -220,7 +220,7 @@ mod test {
.layer(middleware::from_fn(print_request_response));

let request = Request::builder()
.uri("/test_repo/keys")
.uri("/test_repo/keys/")
.header(ACCEPT, ApiVersionKind::V2.to_static_str())
.header(
"Authorization",
Expand Down
8 changes: 4 additions & 4 deletions src/handlers/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ mod test {
// ------------------------------------
// Create a new repository: {path}?create=true
// ------------------------------------
let repo_name_uri = "/repo_remove_me?create=true".to_string();
let repo_name_uri = "/repo_remove_me/?create=true".to_string();
let app = Router::new()
.typed_post(create_repository::<RepositoryPath>)
.layer(middleware::from_fn(print_request_response));
Expand All @@ -145,7 +145,7 @@ mod test {
// ------------------------------------------
// Create a new repository WITHOUT ACL access
// ------------------------------------------
let repo_name_uri = "/repo_not_allowed?create=true".to_string();
let repo_name_uri = "/repo_not_allowed/?create=true".to_string();
let app = Router::new()
.typed_post(create_repository::<RepositoryPath>)
.layer(middleware::from_fn(print_request_response));
Expand All @@ -159,7 +159,7 @@ mod test {
// ------------------------------------------
// Delete a repository WITHOUT ACL access
// ------------------------------------------
let repo_name_uri = "/repo_remove_me?create=true".to_string();
let repo_name_uri = "/repo_remove_me/?create=true".to_string();
let app = Router::new()
.typed_delete(delete_repository::<RepositoryPath>)
.layer(middleware::from_fn(print_request_response));
Expand All @@ -183,7 +183,7 @@ mod test {
// Delete a repository WITH access...
// ------------------------------------------
assert!(path.exists()); // pre condition: repo exists
let repo_name_uri = "/repo_remove_me".to_string();
let repo_name_uri = "/repo_remove_me/".to_string();
let app = Router::new()
.typed_delete(delete_repository::<RepositoryPath>)
.layer(middleware::from_fn(print_request_response));
Expand Down

0 comments on commit e59acd5

Please sign in to comment.