blob: 828032ebc2c572aab285cb92221855d381a67ada (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<?php
class ApiControllerTest extends WebTestHelper {
function setUp() {
$this->helper = new UnitTestHelper();
$this->controller = $this->helper->getController('Api', $this);
loadModel('Config');
$this->Config =& new Config();
// Store the old value so we can reset it in teardown.
$this->_oldVal = $this->Config->getValue('api_disabled');
// Make sure the api is disabled.
$this->Config->save(array('key' => 'api_disabled',
'value' => '1'));
// Clear out the config cache.
$this->Config->expire();
}
function tearDown() {
$this->Config->save(array('key' => 'api_disabled',
'value' => $this->_oldVal));
}
function testApiDisabled() {
$this->assertEqual($this->Config->getValue('api_disabled'), 1);
$this->getAction('/api/list_addons');
$this->assertResponse('503');
}
}
|