-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add data #12
Merged
Merged
test: add data #12
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
fb18479
feat: added test dataset
supermaxiste 749ac70
feat: added test for pass_second and renamed index
supermaxiste 379e8bf
fix: example triple typo
supermaxiste b79b857
Update tests/data/config.yaml
supermaxiste 11956e5
Update tests/data/config.yaml
supermaxiste 0b03724
Update tests/data/config.yaml
supermaxiste 4cbf11d
Update tests/data/config.yaml
supermaxiste 005290c
Update tests/data/config.yaml
supermaxiste 595a7a9
fix: output test file and unit test name
supermaxiste ddaec3a
refactor: rio parsing (#13)
cmdoret e6d7a4e
feat: Improve the documentation (#15)
gabyx bcbaac9
feat: Add a PR template (#14)
gabyx 252ee3c
docs: Improve docs for `direnv`
gabyx 0ceaf09
refactor: stack-allocated trait object for buffers (#16)
gabyx 876bce0
feat: added test for pass_second and renamed index
supermaxiste 61f72ea
refactor(tests): updated tests to new parser
supermaxiste c7652cc
Merge branch 'main' into feat/test-data
supermaxiste 2a2f4ca
fix: formatting
supermaxiste File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,19 @@ pub fn encrypt(log: &Logger, input: &Path, output: &Path, type_map_file: &Path) | |
info!(log, "{:?}", triple.hash_parts(TriplePart::SUBJECT)); | ||
} | ||
} | ||
#[cfg(test)] | ||
mod tests { | ||
use super::encrypt; | ||
use crate::{log, log::Logger}; | ||
use std::path::Path; | ||
|
||
#[test] | ||
// Test the parsing of a triple. | ||
fn simple_encryption() { | ||
let input_path = Path::new("tests/data/test.nt"); | ||
let output_path = Path::new("tests/data/"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the output path should be a file or |
||
let type_map_path = Path::new("tests/data/type_map.nt"); | ||
supermaxiste marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let logger = log::create_logger(true); | ||
encrypt(&logger, &input_path, &output_path, &type_map_path); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# hash URIs of people and online accounts | ||
supermaxiste marked this conversation as resolved.
Show resolved
Hide resolved
|
||
replace-uris-of-nodes-with-type: | ||
"http://xmlns.com/foaf/0.1/Person" # All nodes which are rdf:type Person | ||
supermaxiste marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"http://xmlns.com/foaf/OnlineAccount" # "" OnlineAccount | ||
supermaxiste marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# hash name only for instances of person and online account | ||
supermaxiste marked this conversation as resolved.
Show resolved
Hide resolved
|
||
replace-values-of-predicate-object: | ||
"http://xmlns.com/foaf/OnlineAccount": | ||
"http://schema.org/name" | ||
"http://xmlns.com/foaf/0.1/Person": | ||
"http://schema.org/name" | ||
|
||
# hash accesscode values for all nodes | ||
supermaxiste marked this conversation as resolved.
Show resolved
Hide resolved
|
||
replace-values-of-predicate: | ||
"http://schema.org/accessCode" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<http://example.org/Alice> <http://www.w3.org/2000/01/rdf-schema#type> <http://xmlns.com/foaf/0.1/Person> . | ||
gabyx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<http://example.org/Alice> <http://xmlns.com/foaf/0.1/holdsAccount> <http://example.org/Alice-Bank-Account> . | ||
<http://example.org/Alice-Bank-Account> <http://www.w3.org/2000/01/rdf-schema#type> <http://xmlns.com/foaf/OnlineAccount> . | ||
<http://example.org/Alice-Bank-Account> <http://schema.org/name> "my_account32" . | ||
<http://example.org/Alice-Bank-Account> <http://schema.org/accessCode> "secret-123" . | ||
<http://example.org/Alice> <http://schema.org/name> "Alice" . | ||
<http://example.org/Bob> <http://xmlns.com/foaf/0.1/knows> <http://example.org/Alice> . | ||
<http://example.org/Bob> <http://www.w3.org/2000/01/rdf-schema#type> <http://xmlns.com/foaf/0.1/Person> | ||
<http://example.org/Bob> <http://xmlns.com/foaf/0.1/holdsAccount> <http://example.org/Bob-Bank-Account> . | ||
<http://example.org/Bob-Bank-Account> <http://www.w3.org/2000/01/rdf-schema#type> <http://xmlns.com/foaf/OnlineAccount> . | ||
<http://example.org/Bob-Bank-Account> <http://schema.org/name> "my_account12" . | ||
<http://example.org/Bob-Bank-Account> <http://schema.org/accessCode> "secret-456" . | ||
<http://example.org/Bob> <http://schema.org/name> "Bob" . | ||
<http://example.org/Bank> <http://www.w3.org/2000/01/rdf-schema#type> <http://xmlns.com/foaf/0.1/Organization> . | ||
<http://example.org/Bank> <http://schema.org/name> "Bank" . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<http://example.org/Alice> <http://www.w3.org/2000/01/rdf-schema#type> <http://xmlns.com/foaf/0.1/Person> . | ||
<http://example.org/Alice-Bank-Account> <http://www.w3.org/2000/01/rdf-schema#type> <http://xmlns.com/foaf/OnlineAccount> . | ||
<http://example.org/Bob> <http://www.w3.org/2000/01/rdf-schema#type> <http://xmlns.com/foaf/0.1/Person> . | ||
<http://example.org/Bob-Bank-Account> <http://www.w3.org/2000/01/rdf-schema#type> <http://xmlns.com/foaf/OnlineAccount> . |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! but shouldnt it be http://example.com... in the assert? You wanted it to fail for me to test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the
parse.nt
function is turning any triple into "A", "B" and "C" ;)That's why the test fails when using what's commented right now
https://github.com/sdsc-ordes/rdf-protect/blob/b00e799ed997d335739226e73430403a89d9d0ef/src/model.rs#L58-L62