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§
- Dependency
- Published package dependency builder, see
Package::add_dep
- Http
Server - Http
Server Handle - 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. - Package
- Published package builder for
TestRegistry
- Package
File 🔒 - A file to be created in a package.
- Registry
Builder - Prepare a local
TestRegistry
fixture - Request
- Request to the test http server
- Response
- Response from the test http server
- Test
Registry - A local registry fixture
Enums§
- Entry
Data 🔒 - Entry with data that corresponds to
tar::EntryType
. - Token
- Auth-token for publishing, see
RegistryBuilder::token
Constants§
Functions§
- alt_
api_ path - Path to the alternative-registry version of
api_path
- alt_
dl_ path - Path to the alternative-registry version of
dl_path
- alt_
init - Setup a local “alternative”
TestRegistry
- alt_
registry_ path - Path to the alternative-registry version of
registry_path
- alt_
registry_ 🔒url - URL to the alternative-registry version of
registry_url
- api_
path - Path to the local web API uploads
- cksum
- Generate a checksum
- dl_path
- Path to download
.crate
files using the web API endpoint. - generate_
path 🔒 - generate_
url 🔒 - init
- Setup a local psuedo-crates.io
TestRegistry
- registry_
path - Path to the local index for psuedo-crates.io.
- save_
new_ 🔒crate