mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 18:38:25 +00:00
5fc3fcb9e8
* WIP Sqlite Down methods don't work either, avoid them with refresh for now. WIP persistent support WIP db_schema WIP db_schema 2 Update new migrations... revert dump_db_schema changes for now, too much difference. fix migrations on mysql fix up some more items, this should be our target schema lots of index renames and a two misc changes index rename WIP index rename WIP another round fix up new schema changes try case insensitive fix Trying tests WIP fix down methods DBSetupTest working (uses mysql) Test sqlite migrations work * Properly validate sqlite output * revert glue changes, should be separate PR * remove dusk workaround * remove unused variables * import * sqlite capitalization * Revert some refresh tests * testing_mysql back to testing
49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* BasicApiTest.php
|
|
*
|
|
* -Description-
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* @package LibreNMS
|
|
* @link http://librenms.org
|
|
* @copyright 2019 Tony Murray
|
|
* @author Tony Murray <murraytony@gmail.com>
|
|
*/
|
|
|
|
namespace LibreNMS\Tests;
|
|
|
|
use App\Models\ApiToken;
|
|
use App\Models\Device;
|
|
use App\Models\User;
|
|
|
|
class BasicApiTest extends DBTestCase
|
|
{
|
|
public function testListDevices()
|
|
{
|
|
$user = factory(User::class)->state('admin')->create();
|
|
$token = ApiToken::generateToken($user);
|
|
$device = factory(Device::class)->create();
|
|
|
|
$this->json('GET', '/api/v0/devices', [], ['X-Auth-Token' => $token->token_hash])
|
|
->assertStatus(200)
|
|
->assertJson([
|
|
"status" => "ok",
|
|
"devices" => [$device->toArray()],
|
|
"count"=> 1
|
|
]);
|
|
}
|
|
}
|