Skip to content

Commit

Permalink
Fix tests, move TemplateCollection::default() to derive
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-r committed Oct 28, 2021
1 parent a4871c7 commit 063e2d3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
12 changes: 1 addition & 11 deletions datanymizer_engine/src/settings/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::Deserialize;
use std::collections::HashMap;

/// Shared templates for all instances of `TemplateTransformer`
#[derive(Debug, Deserialize, Clone)]
#[derive(Debug, Deserialize, Clone, Default)]
pub struct TemplatesCollection {
/// Raw named templates.
/// Example:
Expand Down Expand Up @@ -32,16 +32,6 @@ pub struct TemplatesCollection {
pub files: Option<Vec<String>>,
}

/// Default value for `TemplatesCollection`
impl Default for TemplatesCollection {
fn default() -> Self {
Self {
raw: None,
files: None,
}
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
3 changes: 2 additions & 1 deletion datanymizer_engine/src/transformers/internet/email.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ mod tests {
use super::*;

fn user_and_domain(config: &str) -> Vec<String> {
let transformer: EmailTransformer = serde_yaml::from_str(config).unwrap();
let mut transformer: EmailTransformer = serde_yaml::from_str(config).unwrap();
UniqTransformer::init(&mut transformer, &TransformerInitContext::default());
let result = transformer
.transform("field", "orig@domain.com", &None)
.unwrap()
Expand Down
16 changes: 16 additions & 0 deletions dump.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

---
--- Start dumping data
---

---
--- Dump table: public.element
---

COPY public.element("id", "element", "type", "description", "parent_element", "id_parent", "ns_name", "scheme_version") FROM STDIN;
1 Candice \N \N \N
\.

---
--- End dumping data
---
8 changes: 8 additions & 0 deletions fp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
filter:
only:
- public.element
tables:
- name: element
rules:
element:
first_name: {}

0 comments on commit 063e2d3

Please sign in to comment.