feat: tg/ws
This commit is contained in:
@@ -100,8 +100,8 @@ class AdminAgentPortalTest extends TestCase
|
||||
'domains' => ['deployment' => [], 'reporting' => []],
|
||||
'seeds_initialized' => false,
|
||||
'sync_rebuilt' => false,
|
||||
'support_path' => '/web/x/support.html',
|
||||
'daily_path' => '/sync/daily.html',
|
||||
'support_path' => '/channel/x/weifile/weifile.html',
|
||||
'daily_path' => '/channel/x/details/',
|
||||
]);
|
||||
$this->app->instance(ChannelProjectService::class, $projects);
|
||||
|
||||
@@ -111,10 +111,10 @@ class AdminAgentPortalTest extends TestCase
|
||||
->assertJsonPath('code', 0)
|
||||
->json('data.channel_id');
|
||||
$this->assertIsString($random);
|
||||
$this->assertMatchesRegularExpression('/^[a-z0-9]{32}$/', $random);
|
||||
$this->assertMatchesRegularExpression(Channel::NEW_CHANNEL_ID_PATTERN, $random);
|
||||
|
||||
$channelId = Channel::randomChannelId();
|
||||
$this->assertMatchesRegularExpression('/^[a-z0-9]{32}$/', $channelId);
|
||||
$channelId = Channel::randomNewChannelId();
|
||||
$this->assertMatchesRegularExpression(Channel::NEW_CHANNEL_ID_PATTERN, $channelId);
|
||||
|
||||
$this->actingAs($admin, 'admin')
|
||||
->post(route('admin.channels.store'), [
|
||||
@@ -125,10 +125,12 @@ class AdminAgentPortalTest extends TestCase
|
||||
])
|
||||
->assertOk()
|
||||
->assertJsonPath('code', 0)
|
||||
->assertJsonPath('data.links.0', 'https://fallback.test/web/'.$channelId.'/support.html');
|
||||
->assertJsonPath('data.builder_type', Channel::BUILDER_NEW)
|
||||
->assertJsonPath('data.links.0', 'https://fallback.test/channel/'.$channelId.'/weifile/weifile.html');
|
||||
|
||||
$this->assertDatabaseHas('channels', [
|
||||
'channel_id' => $channelId,
|
||||
'builder_type' => Channel::BUILDER_NEW,
|
||||
'user_id' => 0,
|
||||
'remark' => 'official',
|
||||
]);
|
||||
@@ -345,6 +347,39 @@ class AdminAgentPortalTest extends TestCase
|
||||
->assertJsonPath('data.date_to', '2026-08-15');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function admin_can_create_and_update_agent_album_storage_default(): void
|
||||
{
|
||||
$admin = Admin::query()->create(['username' => 'admin', 'password' => 'admin123']);
|
||||
|
||||
$this->actingAs($admin, 'admin')
|
||||
->post(route('admin.agents.store'), [
|
||||
'username' => 'albumagent',
|
||||
'password' => 'secret12',
|
||||
'status' => 1,
|
||||
])
|
||||
->assertOk()
|
||||
->assertJsonPath('code', 0);
|
||||
|
||||
$agent = User::query()->where('username', 'albumagent')->first();
|
||||
$this->assertNotNull($agent);
|
||||
$this->assertFalse($agent->albumStorageDefaultEnabled());
|
||||
|
||||
$this->actingAs($admin, 'admin')
|
||||
->put(route('admin.agents.update', $agent), [
|
||||
'album_storage_default' => 1,
|
||||
])
|
||||
->assertOk()
|
||||
->assertJsonPath('code', 0);
|
||||
|
||||
$this->assertTrue($agent->fresh()->albumStorageDefaultEnabled());
|
||||
|
||||
$this->actingAs($admin, 'admin')
|
||||
->getJson(route('admin.agents.data'))
|
||||
->assertOk()
|
||||
->assertJsonFragment(['username' => 'albumagent', 'album_storage_default' => 1]);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function agent_cannot_create_channel(): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user