forked from iskitsas/http-traffic-simulator
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
17 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
var assert = require("assert"), | ||
should = require('should'), | ||
{ anonymizeFormData, setAnonymization } = require('../lib/anonymizer'), | ||
{ anonymizeFormData, setAnonymization, isAnonymizationEnabled } = require('../lib/anonymizer'), | ||
stream = require('stream'); | ||
|
||
describe('Anonymization Tests for Form Data', () => { | ||
|
||
before(function() { | ||
if (!isAnonymizationEnabled()) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it('should anonymize form data', (done) => { | ||
const formData = `--boundary123\r\nContent-Disposition: form-data; name="first_name"\r\n\r\nJohn\r\n--boundary123\r\nContent-Disposition: form-data; name="last_name"\r\n\r\nDoe\r\n--boundary123\r\nContent-Disposition: form-data; name="email"\r\n\r\[email protected]\r\n--boundary123\r\nContent-Disposition: form-data; name="password"\r\n\r\nsecurepassword123\r\n--boundary123\r\nContent-Disposition: form-data; name="profile_picture"; filename="profile.jpg"\r\nContent-Type: image/jpeg\r\n\r\n<binary data of profile.jpg>\r\n--boundary123--\r\n`; | ||
|
||
|
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,6 +1,6 @@ | ||
var assert = require("assert"), | ||
should = require('should'), | ||
{ anonymizeObject, setAnonymization } = require('../lib/anonymizer'); | ||
{ anonymizeObject, setAnonymization, isAnonymizationEnabled } = require('../lib/anonymizer'); | ||
|
||
describe('Anonymization Tests for JSON Data', () => { | ||
const exampleJson = { | ||
|
@@ -60,6 +60,12 @@ describe('Anonymization Tests for JSON Data', () => { | |
] | ||
}; | ||
|
||
before(function() { | ||
if (!isAnonymizationEnabled()) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it('should anonymize the email', () => { | ||
const anonymizedJson = anonymizeObject({ ...exampleJson }); | ||
anonymizedJson.email.should.equal('[email protected]'); | ||
|