Skip to content

Commit

Permalink
tests: assert HAProxyBackend::advanced_backend is stored as b64 #640
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhendrickson13 committed Jan 11, 2025
1 parent 96eb2ee commit 5622a45
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,18 @@ class APIModelsHAProxyBackendTestCase extends TestCase {
$backend->delete();
$this->assert_is_false(HAProxyBackend::query(id: $backend->id)->exists());
}

/**
* Ensure that the HAProxyBackend::$advanced_backend property is base64 encoded internally.
*/
public function test_advanced_backend_is_base64(): void {
# Ensure the advanced_backend property is base64 encoded when converted to internal config value
$backend = new HAProxyBackend(advanced_backend: 'test');
$this->assert_equals($backend->advanced_backend->to_internal(), base64_encode('test'));

# Ensure the advanced_backend property is base64 decoded when converted from internal config value
$backend = new HAProxyBackend();
$backend->advanced_backend->from_internal(base64_encode('test'));
$this->assert_equals($backend->advanced_backend->value, 'test');
}
}

0 comments on commit 5622a45

Please sign in to comment.