Add web cron ability #821 (#1073)

* Use database for kvp storage

* Read kvpstore

* Add web cron ability through API #821

* Style fixes

* Fix text
This commit is contained in:
Nabeel S
2021-03-09 11:36:56 -05:00
committed by GitHub
parent f1c54bcc7c
commit e70ee5aa6f
13 changed files with 243 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ use App\Models\News;
use App\Models\Subfleet;
use App\Models\User;
use App\Services\FareService;
use App\Support\Utils;
use Exception;
use function random_int;
@@ -312,4 +313,21 @@ class ApiTest extends TestCase
$this->assertNotNull($user);
$this->assertTrue(strpos($user['avatar'], 'gravatar') !== -1);
}
/**
* Test that the web cron runs
*/
public function testWebCron()
{
$this->updateSetting('cron.random_id', '');
$this->get('/api/cron/sdf')->assertStatus(400);
$id = Utils::generateNewId(24);
$this->updateSetting('cron.random_id', $id);
$this->get('/api/cron/sdf')->assertStatus(400);
$res = $this->get('/api/cron/'.$id);
$res->assertStatus(200);
}
}