generated from okp4/template-rust
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(dataset): proper vc parsing case
- Loading branch information
Showing
7 changed files
with
81 additions
and
80 deletions.
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 |
---|---|---|
|
@@ -15,5 +15,6 @@ mod credential; | |
mod error; | ||
pub mod msg; | ||
pub mod state; | ||
mod testutil; | ||
|
||
pub use crate::error::ContractError; |
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,31 @@ | ||
#[cfg(test)] | ||
pub mod testutil { | ||
use okp4_rdf::owned_model::OwnedQuad; | ||
use okp4_rdf::serde::NQuadsReader; | ||
use std::env; | ||
use std::fs::File; | ||
use std::io::{BufReader, Read}; | ||
use std::path::Path; | ||
|
||
pub fn read_test_quads(file: &str) -> Vec<OwnedQuad> { | ||
let raw_rdf = read_test_data(file); | ||
let buffer = BufReader::new(raw_rdf.as_slice()); | ||
let mut reader = NQuadsReader::new(buffer); | ||
reader.read_all().unwrap() | ||
} | ||
|
||
pub fn read_test_data(file: &str) -> Vec<u8> { | ||
let mut bytes: Vec<u8> = Vec::new(); | ||
|
||
File::open( | ||
Path::new(&env::var("CARGO_MANIFEST_DIR").unwrap()) | ||
.join("testdata") | ||
.join(file), | ||
) | ||
.unwrap() | ||
.read_to_end(&mut bytes) | ||
.unwrap(); | ||
|
||
bytes | ||
} | ||
} |
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.edu/credentials/58473> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.w3.org/2018/credentials#VerifiableCredential> . | ||
<http://example.edu/credentials/58473> <https://www.w3.org/2018/credentials#credentialSubject> <did:key:z6MkpwdnLPAm4apwcrRYQ6fZ3rAcqjLZR4AMk14vimfnozqY> . | ||
<http://example.edu/credentials/58473> <https://www.w3.org/2018/credentials#issuanceDate> "2023-05-01T06:09:10Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . | ||
<http://example.edu/credentials/58473> <https://www.w3.org/2018/credentials#issuer> <did:key:z6MkpwdnLPAm4apwcrRYQ6fZ3rAcqjLZR4AMk14vimfnozqY> . |
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,10 @@ | ||
<http://example.edu/credentials/58473> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.w3.org/2018/credentials#VerifiableCredential> . | ||
<http://example.edu/credentials/58473> <https://w3id.org/security#proof> _:b0 . | ||
<http://example.edu/credentials/58473> <https://www.w3.org/2018/credentials#credentialSubject> <did:key:z6MkpwdnLPAm4apwcrRYQ6fZ3rAcqjLZR4AMk14vimfnozqY> . | ||
<http://example.edu/credentials/58473> <https://www.w3.org/2018/credentials#issuanceDate> "2023-05-01T06:09:10Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . | ||
<http://example.edu/credentials/58473> <https://www.w3.org/2018/credentials#issuer> <did:key:z6MkpwdnLPAm4apwcrRYQ6fZ3rAcqjLZR4AMk14vimfnozqY> . | ||
_:b1 <http://purl.org/dc/terms/created> "2024-02-01T17:46:53.676947Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> _:b0 . | ||
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/security#Ed25519Signature2020> _:b0 . | ||
_:b1 <https://w3id.org/security#proofPurpose> <https://w3id.org/security#assertionMethod> _:b0 . | ||
_:b1 <https://w3id.org/security#proofValue> "z3WboEDRwsWokH8vQrveVWbg6fQnqhHfhrkGHT9tyG2GYgzQVZ9zFW6eK2ZNcnGhydqXWDwwTsZq29e7cHJkbnVkF"^^<https://w3id.org/security#multibase> _:b0 . | ||
_:b1 <https://w3id.org/security#verificationMethod> <did:key:z6MkpwdnLPAm4apwcrRYQ6fZ3rAcqjLZR4AMk14vimfnozqY#z6MkpwdnLPAm4apwcrRYQ6fZ3rAcqjLZR4AMk14vimfnozqY> _:b0 . |
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,5 +1,5 @@ | ||
pub mod dataset; | ||
pub mod normalize; | ||
mod owned_model; | ||
pub mod owned_model; | ||
pub mod serde; | ||
pub mod uri; |