Fix: Location of tags should not change in the refactoring

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-06-29 20:52:51 +02:00
parent bd564ad209
commit 0d5027051d

View file

@ -50,7 +50,7 @@ struct TagHeader {
} }
impl<'a> Partial<'a> for TagHeader { impl<'a> Partial<'a> for TagHeader {
const LOCATION: &'static str = "tags"; const LOCATION: &'static str = "tag";
type Output = Self; type Output = Self;
} }
@ -82,7 +82,7 @@ impl Tagable for Entry {
debug!("Setting tags = {:?}", header); debug!("Setting tags = {:?}", header);
self.get_header_mut() self.get_header_mut()
.insert_serialized("tags", header) .insert_serialized("tag", header)
.map(|_| ()) .map(|_| ())
.map_err(|_| Error::from(EM::EntryHeaderWriteError)) .map_err(|_| Error::from(EM::EntryHeaderWriteError))
} }
@ -167,7 +167,7 @@ mod tests {
entry.add_tag(String::from("test")).unwrap(); entry.add_tag(String::from("test")).unwrap();
let v = entry.get_header().read_string("tags.values.[0]").unwrap(); let v = entry.get_header().read_string("tag.values.[0]").unwrap();
assert!(v.is_some()); assert!(v.is_some());
let v = v.unwrap(); let v = v.unwrap();
@ -187,12 +187,12 @@ mod tests {
entry.add_tag(String::from("test")).unwrap(); entry.add_tag(String::from("test")).unwrap();
let v = entry.get_header().read_string("tags.values.[0]").unwrap(); let v = entry.get_header().read_string("tag.values.[0]").unwrap();
assert!(v.is_some()); assert!(v.is_some());
entry.remove_tag(String::from("test")).unwrap(); entry.remove_tag(String::from("test")).unwrap();
assert!(entry.get_header().read_string("tags.values.[0]").is_err()); assert!(entry.get_header().read_string("tag.values.[0]").is_err());
let tags = entry.get_tags(); let tags = entry.get_tags();
assert!(tags.is_ok()); assert!(tags.is_ok());
let tags = tags.unwrap(); let tags = tags.unwrap();
@ -212,7 +212,7 @@ mod tests {
let tags = vec![String::from("testtag")]; let tags = vec![String::from("testtag")];
entry.set_tags(&tags).unwrap(); entry.set_tags(&tags).unwrap();
let v = entry.get_header().read_string("tags.values.[0]").unwrap(); let v = entry.get_header().read_string("tag.values.[0]").unwrap();
assert!(v.is_some()); assert!(v.is_some());
let v = v.unwrap(); let v = v.unwrap();