-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(python): update to use annotations (#302)
- Loading branch information
Showing
15 changed files
with
150 additions
and
648 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,21 +1,40 @@ | ||
const { createInvoker, getEnvironment } = require("../../../helper.js") | ||
const { | ||
createNewInvoker, | ||
getEnvironment, | ||
} = require("../../../helper.js") | ||
const { ruleId, ruleFile, testBase } = getEnvironment(__dirname) | ||
|
||
describe(ruleId, () => { | ||
const invoke = createInvoker(ruleId, ruleFile, testBase) | ||
|
||
test("bad", () => { | ||
const testCase = "bad.py" | ||
expect(invoke(testCase)).toMatchSnapshot() | ||
}) | ||
|
||
test("ok", () => { | ||
const testCase = "ok.py" | ||
expect(invoke(testCase)).toMatchSnapshot() | ||
}) | ||
|
||
test("shared_datatype", () => { | ||
const testCase = "shared_datatype.py" | ||
expect(invoke(testCase)).toMatchSnapshot() | ||
}) | ||
}) | ||
const invoke = createNewInvoker(ruleId, ruleFile, testBase) | ||
|
||
|
||
test("bad", () => { | ||
const testCase = "bad.py" | ||
|
||
const results = invoke(testCase) | ||
|
||
expect(results.Missing).toEqual([]) | ||
expect(results.Extra).toEqual([]) | ||
}) | ||
|
||
|
||
test("ok", () => { | ||
const testCase = "ok.py" | ||
|
||
const results = invoke(testCase) | ||
|
||
expect(results.Missing).toEqual([]) | ||
expect(results.Extra).toEqual([]) | ||
}) | ||
|
||
|
||
test("shared_datatype", () => { | ||
const testCase = "shared_datatype.py" | ||
|
||
const results = invoke(testCase) | ||
|
||
expect(results.Missing).toEqual([]) | ||
expect(results.Extra).toEqual([]) | ||
}) | ||
|
||
}) |
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
130 changes: 0 additions & 130 deletions
130
tests/python/lang/weak_hash_md5/__snapshots__/test.js.snap
This file was deleted.
Oops, something went wrong.
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,16 +1,30 @@ | ||
const { createInvoker, getEnvironment } = require("../../../helper.js") | ||
const { | ||
createNewInvoker, | ||
getEnvironment, | ||
} = require("../../../helper.js") | ||
const { ruleId, ruleFile, testBase } = getEnvironment(__dirname) | ||
|
||
describe(ruleId, () => { | ||
const invoke = createInvoker(ruleId, ruleFile, testBase) | ||
const invoke = createNewInvoker(ruleId, ruleFile, testBase) | ||
|
||
test("bad", () => { | ||
const testCase = "bad.py" | ||
expect(invoke(testCase)).toMatchSnapshot() | ||
}) | ||
|
||
test("bad", () => { | ||
const testCase = "bad.py" | ||
|
||
test("ok", () => { | ||
const testCase = "ok.py" | ||
expect(invoke(testCase)).toMatchSnapshot() | ||
}) | ||
}) | ||
const results = invoke(testCase) | ||
|
||
expect(results.Missing).toEqual([]) | ||
expect(results.Extra).toEqual([]) | ||
}) | ||
|
||
|
||
test("ok", () => { | ||
const testCase = "ok.py" | ||
|
||
const results = invoke(testCase) | ||
|
||
expect(results.Missing).toEqual([]) | ||
expect(results.Extra).toEqual([]) | ||
}) | ||
|
||
}) |
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,12 +1,15 @@ | ||
import hashlib | ||
|
||
result = hashlib.md5() | ||
# bearer:expected python_lang_weak_hash_md5 | ||
result.update('password') | ||
result.digest() | ||
|
||
# bearer:expected python_lang_weak_hash_md5 | ||
result = hashlib.md5(b'password') | ||
result.digest() | ||
|
||
username = user.name | ||
# bearer:expected python_lang_weak_hash_md5 | ||
result = hashlib.md5(username.encode()) | ||
result.hexdigest() |
Oops, something went wrong.