diff options
author | Allan Wang <me@allanwang.ca> | 2019-08-13 23:57:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-13 23:57:52 -0700 |
commit | e47d5d47c0997b9a696f4f8881f4a057e2a5f934 (patch) | |
tree | ac985d192580735c34e31fa0583e60ecaf54a147 /app/src/test/kotlin/com | |
parent | b47900cbf82cdb216f7e3bd7961d29b7f6e1e507 (diff) | |
parent | da3f1bb99df7f75e6adc62aa8aae15716033789b (diff) | |
download | frost-e47d5d47c0997b9a696f4f8881f4a057e2a5f934.tar.gz frost-e47d5d47c0997b9a696f4f8881f4a057e2a5f934.tar.bz2 frost-e47d5d47c0997b9a696f4f8881f4a057e2a5f934.zip |
Merge pull request #1514 from AllanWang/theopensourceguy-native-toggle
Tag obfuscation
Diffstat (limited to 'app/src/test/kotlin/com')
-rw-r--r-- | app/src/test/kotlin/com/pitchedapps/frost/injectors/TagObfuscatorTest.kt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/injectors/TagObfuscatorTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/injectors/TagObfuscatorTest.kt new file mode 100644 index 00000000..5c316a4a --- /dev/null +++ b/app/src/test/kotlin/com/pitchedapps/frost/injectors/TagObfuscatorTest.kt @@ -0,0 +1,22 @@ +package com.pitchedapps.frost.injectors + +import java.util.UUID +import kotlin.test.Test +import kotlin.test.assertEquals + +class TagObfuscatorTest { + + /** + * The same key should result in the same tag per session + */ + @Test + fun consistentTags() { + val keys = generateSequence { UUID.randomUUID().toString() }.take(10).toSet() + val tags = keys.map { + val tag = generateSequence { TagObfuscator.obfuscateTag(it) }.take(10).toSet() + assertEquals(1, tag.size, "Key $it produced multiple tags: $tag") + tag.first() + } + assertEquals(keys.size, tags.size, "Key set and tag set have different sizes") + } +} |