pub struct FakeNeon { /* private fields */ }Available on crate feature
neon only.Expand description
One Neon project in memory, behaving as the spike found the real one does (docs/neon.md):
a new branch copies its parent’s functions, buckets and credentials at creation, a reset
leaves functions alone, and annotations are kept. Every change is recorded
(calls).
Implementations§
Source§impl FakeNeon
impl FakeNeon
Sourcepub fn new(project: &str) -> Self
pub fn new(project: &str) -> Self
The project project with one default branch, main (database neondb, storage
enabled), signed in.
Sourcepub fn from_fixtures(project: &str, dir: &Path) -> Result<Self, String>
pub fn from_fixtures(project: &str, dir: &Path) -> Result<Self, String>
The project as the spike captured it in dir (tests/fixtures/neon/<version>/): its
branches with their annotations (api-branches.json, branches-list.json) and the
functions on the default branch (functions-list.json).
Sourcepub fn deploy_function(&self, name_or_id: &str, slug: &str)
pub fn deploy_function(&self, name_or_id: &str, slug: &str)
Deploy the function slug on the branch name_or_id.
Sourcepub fn set_signed_in(&self, signed_in: bool)
pub fn set_signed_in(&self, signed_in: bool)
Sign the CLI out (or back in).
Sourcepub fn credentials(&self, name_or_id: &str) -> Vec<String>
pub fn credentials(&self, name_or_id: &str) -> Vec<String>
The credentials on the branch name_or_id, by token id.
Trait Implementations§
Source§impl NeonControl for FakeNeon
impl NeonControl for FakeNeon
Source§fn auth_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn auth_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Who the CLI is signed in as (an error when it isn’t).
Source§fn branches<'life0, 'life1, 'async_trait>(
&'life0 self,
project: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Branch>, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn branches<'life0, 'life1, 'async_trait>(
&'life0 self,
project: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Branch>, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The project’s branches, with their annotations.
Source§fn create_branch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
spec: &'life2 CreateBranch,
) -> Pin<Box<dyn Future<Output = Result<Branch, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn create_branch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
spec: &'life2 CreateBranch,
) -> Pin<Box<dyn Future<Output = Result<Branch, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create a branch (never printing its credentials).
Source§fn delete_branch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_branch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete the branch
id.Source§fn reset_branch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn reset_branch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Reset the branch
id to its parent’s current state.Source§fn connection<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
database: Option<&'life3 str>,
pooled: bool,
) -> Pin<Box<dyn Future<Output = Result<Connection, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn connection<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
database: Option<&'life3 str>,
pooled: bool,
) -> Pin<Box<dyn Future<Output = Result<Connection, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
The branch’s Postgres connection to
database (the default one when None), through
the connection pooler when pooled.Source§fn databases<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn databases<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The branch’s databases.
Source§fn create_database<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
name: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn create_database<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
name: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Create the database
name on the branch.Source§fn functions<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Function>, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn functions<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Function>, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The functions deployed on the branch.
Source§fn storage<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Storage, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn storage<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Storage, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The branch’s object storage.
Source§fn buckets<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn buckets<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The branch’s buckets.
Source§fn create_bucket<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
name: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn create_bucket<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
name: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Create the bucket
name on the branch.Source§fn create_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
name: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<StorageCredential, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn create_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
name: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<StorageCredential, NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Mint a storage credential (read and write) called
name on the branch.Source§fn revoke_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
token_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn revoke_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
branch: &'life2 str,
token_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Revoke the credential
token_id on the branch.Auto Trait Implementations§
impl Freeze for FakeNeon
impl RefUnwindSafe for FakeNeon
impl Send for FakeNeon
impl Sync for FakeNeon
impl Unpin for FakeNeon
impl UnsafeUnpin for FakeNeon
impl UnwindSafe for FakeNeon
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more