Skip to content

Commit 2d2ba9e

Browse files
committed
added some tests around obfuscation
1 parent 5efe205 commit 2d2ba9e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/specs/test-sparkpost.class.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ function setUp() {
1111
$this->SparkPost = new SparkPost();
1212
}
1313

14+
function test_obfuscate_api_key() {
15+
$original_key='my_secret_key';
16+
$obfuscated_key=SparkPost::obfuscate_api_key($original_key);
17+
18+
$this->assertNotFalse(strpos($obfuscated_key, '*'));
19+
$this->assertEquals(substr($original_key, 0, 4), substr($obfuscated_key, 0, 4));
20+
}
21+
22+
function test_is_key_obfuscated() {
23+
$this->assertTrue(SparkPost::is_key_obfuscated('my_obfuscated_***'));
24+
$this->assertFalse(SparkPost::is_key_obfuscated('my_unobfuscated_key'));
25+
}
26+
1427
function test_is_sandbox() {
1528
$this->assertTrue(SparkPost::is_sandbox('[email protected]'));
1629
$this->assertFalse(SparkPost::is_sandbox('[email protected]'));

0 commit comments

Comments
 (0)