You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mock.rs
    path of file: ./repos/acria-substrate/orml/authority/src
    
    the code of the file until where you have to start completion: //! Mocks for the authority module.

#![cfg(test)]

use super::*;
use codec::{Decode, Encode};
use frame_support::{
	parameter_types,
	traits::{OnFinalize, OnInitialize},
	weights::Weight,
};
use frame_system::{ensure_root, ensure_signed, EnsureRoot};
use sp_core::H256;
use sp_runtime::{
	testing::Header,
	t
    
	fn check_dispatch_from(&self, origin: Origin) -> DispatchResult {
		ensure_root(origin.clone()).or_else(|_| {
			if let OriginCaller::authority(ref sign) = origin.caller() {
				if sign.origin == Box::new(Origin::root().caller().clone()) {
					return Ok(());
				} else {
					return Err(BadOrigin.into());
				}
			}

			let ok = match self {
				MockAsOriginId::Root => false,
				MockAsOriginId::Account1 => ensure_signed(origin)? == 1,
				MockAsOriginId::Account2 => ensure_signed(origin)? == 2,
			};
			return if ok { Ok(()) } else { Err(BadOrigin.into()) };
		})
	}