Expand description
Interact with the TestRegistry
Β§Example
use cargo_test_support::registry::Package;
use cargo_test_support::project;
use cargo_test_support::str;
// Publish package "a" depending on "b".
Package::new("a", "1.0.0")
.dep("b", "1.0.0")
.file("src/lib.rs", r#"
extern crate b;
pub fn f() -> i32 { b::f() * 2 }
"#)
.publish();
// Publish package "b".
Package::new("b", "1.0.0")
.file("src/lib.rs", r#"
pub fn f() -> i32 { 12 }
"#)
.publish();
// Create a project that uses package "a".
let p = project()
.file("Cargo.toml", r#"
[package]
name = "foo"
version = "0.0.1"
[dependencies]
a = "1.0"
"#)
.file("src/main.rs", r#"
extern crate a;
fn main() { println!("{}", a::f()); }
"#)
.build();
p.cargo("run").with_stdout_data(str!["24"]).run();
Structs§
- Published package dependency builder, see
Package::add_dep
- Mutation πA helper struct that collects the arguments for
HttpServer::check_authorized
. Based on looking at the request, these are the fields that the authentication header should attest to. - Published package builder for
TestRegistry
- Package
File πA file to be created in a package. - Prepare a local
TestRegistry
fixture - Request to the test http server
- Response from the test http server
- A local registry fixture
Enums§
- Entry
Data πEntry with data that corresponds totar::EntryType
. - Auth-token for publishing, see
RegistryBuilder::token
Constants§
- DEFAULT_
MODE π
Functions§
- Path to the alternative-registry version of
api_path
- Path to the alternative-registry version of
dl_path
- Setup a local βalternativeβ
TestRegistry
- Path to the alternative-registry version of
registry_path
- alt_
registry_ πurl URL to the alternative-registry version ofregistry_url
- Path to the local web API uploads
- Generate a checksum
- Path to download
.crate
files using the web API endpoint. - generate_
path π - generate_
url π - Setup a local psuedo-crates.io
TestRegistry
- Path to the local index for psuedo-crates.io.
- save_
new_ πcrate
Type Aliases§
- Feature
Map π - Request
Callback π