| | |
| | | } |
| | | } |
| | | |
| | | pub(crate) fn rejected_origin_status( |
| | | reason: &str, |
| | | attributes: &HashMap<String, String>, |
| | | ) -> &'static str { |
| | | let status = Self::origin_status(attributes); |
| | | if status == "sequence_absent" { |
| | | status |
| | | } else { |
| | | Self::rejection_status(reason) |
| | | } |
| | | } |
| | | |
| | | pub(crate) fn from_participant( |
| | | attributes: &HashMap<String, String>, |
| | | ) -> Result<Option<Self>, &'static str> { |
| | |
| | | AudioIngressMetadata::rejection_status("invalid_source_or_sequence") |
| | | ); |
| | | assert_eq!( |
| | | "sequence_replayed_or_regressed", |
| | | "origin_unprovable", |
| | | AudioIngressMetadata::rejection_status("sequence_replayed") |
| | | ); |
| | | assert_eq!( |
| | | "wrong_participant_or_track", |
| | | "origin_unprovable", |
| | | AudioIngressMetadata::rejection_status("wrong_participant") |
| | | ); |
| | | assert_eq!( |
| | | "origin_unprovable", |
| | | AudioIngressMetadata::rejection_status("unknown") |
| | | ); |
| | | let missing_sequence = HashMap::from([( |
| | | "inputSourceCategory".to_string(), |
| | | "controlled_fixture".to_string(), |
| | | )]); |
| | | assert_eq!( |
| | | "sequence_absent", |
| | | AudioIngressMetadata::rejected_origin_status("incomplete_metadata", &missing_sequence) |
| | | ); |
| | | assert_eq!(8, AudioIngressMetadata::ORIGIN_STATUSES.len()); |
| | | } |
| | | |