-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revert unintended change feat: rust code fix configuration loading feat: fix settings (rust) fix configuration loading feat: fix settings (rust) feat: rust code debugging feat: rust code debugging feat: rust code debugging feat: rust code debugging feat: rust code debugging fix configuration loading feat: fix settings (rust) fix configuration loading feat: fix settings (rust) feat: rust code debugging feat: rust code debugging feat: rust code debugging feat: rust code debugging feat: rust code debugging refactor: existing python code refactor: existing python code refactor: existing python code refactor: existing python code
- Loading branch information
Showing
9 changed files
with
54 additions
and
49 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
16 changes: 8 additions & 8 deletions
16
python/test/test_base64.py → python/tests/test_ckeck_digit.py
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,33 +1,33 @@ | ||
import ark_resolver.base64url_check_digit as base64url_check_digit_py | ||
from ark_resolver import check_digit as ckeck_digit_py | ||
|
||
def test_base64url_check_digit(): | ||
correct_resource_id = "cmfk1DMHRBiR4-_6HXpEFA" | ||
|
||
# reject a string without a check digit | ||
assert not base64url_check_digit_py.is_valid(correct_resource_id) | ||
assert not ckeck_digit_py.is_valid(correct_resource_id) | ||
|
||
# calculate a check digit for a string and validate it | ||
correct_resource_id_check_digit = "n" | ||
check_digit = base64url_check_digit_py.calculate_check_digit(correct_resource_id) | ||
check_digit = ckeck_digit_py.calculate_check_digit(correct_resource_id) | ||
assert check_digit == correct_resource_id_check_digit | ||
correct_resource_id_with_correct_check_digit = correct_resource_id + check_digit | ||
assert base64url_check_digit_py.is_valid(correct_resource_id_with_correct_check_digit) | ||
assert ckeck_digit_py.is_valid(correct_resource_id_with_correct_check_digit) | ||
|
||
# reject a string with an incorrect check digit | ||
correct_resource_id_with_incorrect_check_digit = correct_resource_id + "m" | ||
assert not base64url_check_digit_py.is_valid(correct_resource_id_with_incorrect_check_digit) | ||
assert not ckeck_digit_py.is_valid(correct_resource_id_with_incorrect_check_digit) | ||
|
||
# reject a string with a missing character | ||
resource_id_with_missing_character = "cmfk1DMHRBiR4-6HXpEFA" | ||
resource_id_with_missing_character_and_correct_check_digit = resource_id_with_missing_character + correct_resource_id_check_digit | ||
assert not base64url_check_digit_py.is_valid(resource_id_with_missing_character_and_correct_check_digit) | ||
assert not ckeck_digit_py.is_valid(resource_id_with_missing_character_and_correct_check_digit) | ||
|
||
# reject a string with an incorrect character | ||
resource_id_with_incorrect_character = "cmfk1DMHRBir4-_6HXpEFA" | ||
resource_id_with_incorrect_character_and_correct_check_digit = resource_id_with_incorrect_character + correct_resource_id_check_digit | ||
assert not base64url_check_digit_py.is_valid(resource_id_with_incorrect_character_and_correct_check_digit) | ||
assert not ckeck_digit_py.is_valid(resource_id_with_incorrect_character_and_correct_check_digit) | ||
|
||
# reject a string with swapped characters | ||
resource_id_with_swapped_characters = "cmfk1DMHRBiR4_-6HXpEFA" | ||
resource_id_with_swapped_characters_and_correct_check_digit = resource_id_with_swapped_characters + correct_resource_id_check_digit | ||
assert not base64url_check_digit_py.is_valid(resource_id_with_swapped_characters_and_correct_check_digit) | ||
assert not ckeck_digit_py.is_valid(resource_id_with_swapped_characters_and_correct_check_digit) |