pub struct FakeTracker { /* private fields */ }Expand description
An in-memory Tracker for module tests: records every accepted
file/status/comment call and answers according to its
TrackerMode. A
call the mode answered with an error is not recorded, as FakePush
does not record a failed send.
The mode is global by default and can be overridden per destination
(FakeTracker::set_mode_for), the FakePush shape: one tenant’s
expired token among live ones. The state an accepted status reports
is scripted separately (FakeTracker::set_state), because “the file
succeeded” and “the ticket has moved on since” are two different
answers a test wants to set independently.
Implementations§
Source§impl FakeTracker
impl FakeTracker
pub fn new(mode: TrackerMode) -> Self
Sourcepub fn last_filed(&self) -> Option<FiledCall>
pub fn last_filed(&self) -> Option<FiledCall>
The most recent file accepted.
Sourcepub fn statused(&self) -> Vec<StatusedCall>
pub fn statused(&self) -> Vec<StatusedCall>
Every status accepted so far, in order.
Sourcepub fn commented(&self) -> Vec<CommentedCall>
pub fn commented(&self) -> Vec<CommentedCall>
Every comment accepted so far, in order.
Sourcepub fn set_mode(&self, mode: TrackerMode)
pub fn set_mode(&self, mode: TrackerMode)
Switches the mode every destination without an override answers
with (e.g. flip to Unauthorized mid-test).
Sourcepub fn set_mode_for(&self, dest: &Destination, mode: TrackerMode)
pub fn set_mode_for(&self, dest: &Destination, mode: TrackerMode)
Makes one destination answer with mode, whatever the global mode
is — one tenant’s expired token among live ones, say.
Sourcepub fn clear_mode_for(&self, dest: &Destination)
pub fn clear_mode_for(&self, dest: &Destination)
Drops one destination’s override, putting it back on the global mode.
Sourcepub fn mode_for(&self, dest: &Destination) -> TrackerMode
pub fn mode_for(&self, dest: &Destination) -> TrackerMode
The mode dest will answer with.
Sourcepub fn set_state(&self, state: TicketState)
pub fn set_state(&self, state: TicketState)
The state an accepted status reports.
Sourcepub fn state(&self) -> TicketState
pub fn state(&self) -> TicketState
The state an accepted status currently reports.
Trait Implementations§
Source§impl Clone for FakeTracker
impl Clone for FakeTracker
Source§impl Debug for FakeTracker
impl Debug for FakeTracker
Source§impl Default for FakeTracker
impl Default for FakeTracker
Source§impl Tracker for FakeTracker
impl Tracker for FakeTracker
Source§fn file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dest: &'life1 Destination,
cred: &'life2 Credential,
draft: &'life3 TicketDraft,
) -> Pin<Box<dyn Future<Output = Result<Filed, TrackerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dest: &'life1 Destination,
cred: &'life2 Credential,
draft: &'life3 TicketDraft,
) -> Pin<Box<dyn Future<Output = Result<Filed, TrackerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
draft into dest, authenticating as the company cred
speaks for. Idempotent on draft.idempotency_key where the tracker
allows it. Read moreSource§fn status<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dest: &'life1 Destination,
cred: &'life2 Credential,
external_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<TicketStatus, TrackerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn status<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dest: &'life1 Destination,
cred: &'life2 Credential,
external_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<TicketStatus, TrackerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
dest. Read moreSource§fn comment<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
dest: &'life1 Destination,
cred: &'life2 Credential,
external_id: &'life3 str,
comment: &'life4 TicketComment,
) -> Pin<Box<dyn Future<Output = Result<(), TrackerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn comment<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
dest: &'life1 Destination,
cred: &'life2 Credential,
external_id: &'life3 str,
comment: &'life4 TicketComment,
) -> Pin<Box<dyn Future<Output = Result<(), TrackerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
comment to the existing ticket external_id in dest —
e.g. linking a duplicate report to the ticket it duplicates, so the
tracker holds one ticket per defect rather than one per report. Read more