Skip to content

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Sep 28, 2022
1 parent fc0dcbc commit adf4990
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ pub struct Store {
default_agent: Arc<Mutex<Option<crate::agents::Agent>>>,
}

/// The URL used for stores that are not accessible on the web.
pub const LOCAL_STORE_URL_STR: &str = "local:store";

lazy_static::lazy_static! {
static ref LOCAL_STORE_URL: Url = Url::parse("local:store").unwrap();
static ref LOCAL_STORE_URL: Url = Url::parse(LOCAL_STORE_URL_STR).unwrap();
}

impl Store {
Expand Down
4 changes: 4 additions & 0 deletions lib/src/storelike.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{
errors::AtomicError,
hierarchy,
schema::{Class, Property},
store::LOCAL_STORE_URL_STR,
values::query_value_compare,
};
use crate::{errors::AtomicResult, parse::parse_json_ad_string};
Expand Down Expand Up @@ -223,6 +224,9 @@ pub trait Storelike: Sized {
/// the answer should always be `true`.
fn is_external_subject(&self, subject: &str) -> AtomicResult<bool> {
if let Some(self_url) = self.get_self_url() {
if self_url.as_str() == LOCAL_STORE_URL_STR {
return Ok(true);
}
if subject.starts_with(&self_url.as_str()) {
return Ok(false);
} else {
Expand Down

0 comments on commit adf4990

Please sign in to comment.