Skip to content

Commit 534032f

Browse files
Fix, and link, Fernet tests (#2335)
1 parent ba09f5f commit 534032f

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

tests/operations/index.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ import "./tests/ExtractAudioMetadata.mjs";
7272
import "./tests/ExtractEmailAddresses.mjs";
7373
import "./tests/ExtractHashes.mjs";
7474
import "./tests/ExtractIPAddresses.mjs";
75+
import "./tests/Fernet.mjs";
7576
import "./tests/Float.mjs";
7677
import "./tests/FileTree.mjs";
7778
import "./tests/FletcherChecksum.mjs";

tests/operations/tests/Fernet.mjs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @copyright Karsten Silkenbäumer 2019
66
* @license Apache-2.0
77
*/
8-
import TestRegister from "../TestRegister";
8+
import TestRegister from "../../lib/TestRegister.mjs";
99

1010
TestRegister.addTests([
1111
{
@@ -47,7 +47,7 @@ TestRegister.addTests([
4747
{
4848
name: "Fernet Encrypt: no input",
4949
input: "",
50-
expectedMatch: /^gAAAAABce-[\w-]+={0,2}$/,
50+
expectedMatch: /^gAAA[\w-]+={0,2}$/,
5151
recipeConfig: [
5252
{
5353
op: "Fernet Encrypt",
@@ -69,12 +69,27 @@ TestRegister.addTests([
6969
{
7070
name: "Fernet Encrypt: valid arguments",
7171
input: "This is a secret message.\n",
72-
expectedMatch: /^gAAAAABce-[\w-]+={0,2}$/,
72+
expectedMatch: /^gAAA[\w-]+={0,2}$/,
7373
recipeConfig: [
7474
{
7575
op: "Fernet Encrypt",
7676
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
7777
}
7878
],
79+
},
80+
{
81+
name: "Fernet Encrypt/Decrypt: round trip",
82+
input: "This is a secret message.\n",
83+
expectedOutput: "This is a secret message.\n",
84+
recipeConfig: [
85+
{
86+
op: "Fernet Encrypt",
87+
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
88+
},
89+
{
90+
op: "Fernet Decrypt",
91+
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
92+
},
93+
],
7994
}
8095
]);

0 commit comments

Comments
 (0)