admin
This commit is contained in:
@@ -90,7 +90,11 @@ class AdminAgentPortalTest extends TestCase
|
||||
$admin = Admin::query()->create(['username' => 'admin', 'password' => 'admin123']);
|
||||
|
||||
$projects = Mockery::mock(ChannelProjectService::class);
|
||||
$projects->shouldReceive('generate')->once()->with(Mockery::type('string'), Mockery::type('array'));
|
||||
$projects->shouldReceive('generate')->once()->with(
|
||||
Mockery::type('string'),
|
||||
Mockery::type('array'),
|
||||
Mockery::any()
|
||||
);
|
||||
$this->app->instance(ChannelProjectService::class, $projects);
|
||||
|
||||
$random = $this->actingAs($admin, 'admin')
|
||||
|
||||
@@ -47,6 +47,7 @@ class ChannelProjectServiceTest extends TestCase
|
||||
&& $request->data() === [
|
||||
'deployment_domains' => ['deploy.test'],
|
||||
'reporting_domains' => ['report.test'],
|
||||
'support_template' => 'test',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -60,6 +61,21 @@ class ChannelProjectServiceTest extends TestCase
|
||||
Http::assertSent(fn ($request) => $request->data() === [
|
||||
'deployment_domains' => ['channel.only.test'],
|
||||
'reporting_domains' => ['report.test'],
|
||||
'support_template' => 'test',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function it_forwards_support_template_to_builder(): void
|
||||
{
|
||||
Http::fake(['builder.test/*' => Http::response(['ok' => true])]);
|
||||
|
||||
app(ChannelProjectService::class)->generate(self::CHANNEL_ID, null, 'blank');
|
||||
|
||||
Http::assertSent(fn ($request) => $request->data() === [
|
||||
'deployment_domains' => ['deploy.test'],
|
||||
'reporting_domains' => ['report.test'],
|
||||
'support_template' => 'blank',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,27 @@ class TelegramBotTest extends TestCase
|
||||
)->assertNoContent();
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function webhook_acks_even_when_bot_run_fails(): void
|
||||
{
|
||||
$this->app->bind(Nutgram::class, function () {
|
||||
throw new \RuntimeException('deliberate nutgram failure');
|
||||
});
|
||||
|
||||
$this->call(
|
||||
'POST',
|
||||
'/hooks/telegram',
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
[
|
||||
'CONTENT_TYPE' => 'application/json',
|
||||
'HTTP_X_TELEGRAM_BOT_API_SECRET_TOKEN' => 'test-secret',
|
||||
],
|
||||
json_encode(['update_id' => 99, 'message' => ['text' => '/ping']])
|
||||
)->assertNoContent();
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function unauthorized_chat_is_silent(): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user