| @@ 24-37 (lines=14) @@ | ||
| 21 | ||
| 22 | class ConnectionTest extends PHPUnit_Framework_TestCase |
|
| 23 | { |
|
| 24 | public function testConnect() |
|
| 25 | { |
|
| 26 | $c = new Connection(__DIR__); |
|
| 27 | $c->connect( |
|
| 28 | [ |
|
| 29 | 'INSTANCE_ID' => 'vpn.example', |
|
| 30 | 'POOL_ID' => 'internet', |
|
| 31 | 'common_name' => 'foo_xyz', |
|
| 32 | 'time_unix' => 1234567890, |
|
| 33 | 'ifconfig_pool_remote_ip' => '10.10.10.25', |
|
| 34 | 'ifconfig_pool_remote_ip6' => 'fd00:1234::25', |
|
| 35 | ] |
|
| 36 | ); |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @expectedException \SURFnet\VPN\Server\Exception\ConnectionException |
|
| @@ 43-56 (lines=14) @@ | ||
| 40 | * @expectedException \SURFnet\VPN\Server\Exception\ConnectionException |
|
| 41 | * @expectedExceptionMessage client not allowed, user is disabled |
|
| 42 | */ |
|
| 43 | public function testDisabledUser() |
|
| 44 | { |
|
| 45 | $c = new Connection(__DIR__); |
|
| 46 | $c->connect( |
|
| 47 | [ |
|
| 48 | 'INSTANCE_ID' => 'vpn.example', |
|
| 49 | 'POOL_ID' => 'internet', |
|
| 50 | 'common_name' => 'bar_xyz', |
|
| 51 | 'time_unix' => 1234567890, |
|
| 52 | 'ifconfig_pool_remote_ip' => '10.10.10.25', |
|
| 53 | 'ifconfig_pool_remote_ip6' => 'fd00:1234::25', |
|
| 54 | ] |
|
| 55 | ); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @expectedException \SURFnet\VPN\Server\Exception\ConnectionException |
|
| @@ 62-75 (lines=14) @@ | ||
| 59 | * @expectedException \SURFnet\VPN\Server\Exception\ConnectionException |
|
| 60 | * @expectedExceptionMessage client not allowed, CN is disabled |
|
| 61 | */ |
|
| 62 | public function testDisabledCommonName() |
|
| 63 | { |
|
| 64 | $c = new Connection(__DIR__); |
|
| 65 | $c->connect( |
|
| 66 | [ |
|
| 67 | 'INSTANCE_ID' => 'vpn.example', |
|
| 68 | 'POOL_ID' => 'internet', |
|
| 69 | 'common_name' => 'foo_disabled', |
|
| 70 | 'time_unix' => 1234567890, |
|
| 71 | 'ifconfig_pool_remote_ip' => '10.10.10.25', |
|
| 72 | 'ifconfig_pool_remote_ip6' => 'fd00:1234::25', |
|
| 73 | ] |
|
| 74 | ); |
|
| 75 | } |
|
| 76 | ||
| 77 | public function testAclIsMember() |
|
| 78 | { |
|
| @@ 77-90 (lines=14) @@ | ||
| 74 | ); |
|
| 75 | } |
|
| 76 | ||
| 77 | public function testAclIsMember() |
|
| 78 | { |
|
| 79 | $c = new Connection(__DIR__); |
|
| 80 | $c->connect( |
|
| 81 | [ |
|
| 82 | 'INSTANCE_ID' => 'vpn.example', |
|
| 83 | 'POOL_ID' => 'bar', |
|
| 84 | 'common_name' => 'foo_xyz', |
|
| 85 | 'time_unix' => 1234567890, |
|
| 86 | 'ifconfig_pool_remote_ip' => '10.10.10.25', |
|
| 87 | 'ifconfig_pool_remote_ip6' => 'fd00:1234::25', |
|
| 88 | ] |
|
| 89 | ); |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * @expectedException \SURFnet\VPN\Server\Exception\ConnectionException |
|
| @@ 96-109 (lines=14) @@ | ||
| 93 | * @expectedException \SURFnet\VPN\Server\Exception\ConnectionException |
|
| 94 | * @expectedExceptionMessage client not allowed, not a member of "all" |
|
| 95 | */ |
|
| 96 | public function testAclIsNoMember() |
|
| 97 | { |
|
| 98 | $c = new Connection(__DIR__); |
|
| 99 | $c->connect( |
|
| 100 | [ |
|
| 101 | 'INSTANCE_ID' => 'vpn.example', |
|
| 102 | 'POOL_ID' => 'bar', |
|
| 103 | 'common_name' => 'xyz_abc', |
|
| 104 | 'time_unix' => 1234567890, |
|
| 105 | 'ifconfig_pool_remote_ip' => '10.10.10.25', |
|
| 106 | 'ifconfig_pool_remote_ip6' => 'fd00:1234::25', |
|
| 107 | ] |
|
| 108 | ); |
|
| 109 | } |
|
| 110 | } |
|
| 111 | ||