feat: install plugins from approved source commits
This commit is contained in:
+14
-2
@@ -138,6 +138,11 @@ final class FakeAdapter implements SourceAdapter
|
||||
return $this->releases;
|
||||
}
|
||||
|
||||
public function sourceArchiveUrl(array $repository, string $commitSha): ?string
|
||||
{
|
||||
return 'https://git.mrblake.cc/' . $repository['fullName'] . '/archive/' . $commitSha . '.tar.gz';
|
||||
}
|
||||
|
||||
public function hashArtifact(string $url, string $expectedSha256 = ''): array
|
||||
{
|
||||
$this->hashCalls++;
|
||||
@@ -232,6 +237,7 @@ function approvedFixture(): array
|
||||
'title' => '1.2.3', 'downloadUrl' => 'https://git.mrblake.cc/assets/netbox_demo-1.2.3-py3-none-any.whl',
|
||||
'releaseUrl' => 'https://git.mrblake.cc/releases/1', 'sha256' => str_repeat('b', 64),
|
||||
'artifactSize' => 12_345, 'commitSha' => str_repeat('a', 40), 'artifactKind' => 'wheel',
|
||||
'artifactFilename' => 'netbox_demo-1.2.3-py3-none-any.whl',
|
||||
'minNetboxVersion' => '4.6.5', 'maxNetboxVersion' => '4.6.8', 'publishedAt' => '2026-08-20T10:00:00Z',
|
||||
'draft' => false, 'withdrawn' => false, 'status' => 'pending',
|
||||
'approvedAt' => null, 'approvedBy' => null, 'approvedPayloadSha256' => '',
|
||||
@@ -432,7 +438,7 @@ test('Forgejo and GitHub account repository and release pages before accumulatio
|
||||
test('catalog and release-detail API keep the exact client contract', static function () use ($config, $guard, $http): void {
|
||||
$state = approvedFixture();
|
||||
$releaseKeys = [
|
||||
'version', 'download_url', 'sha256', 'artifact_size', 'commit_sha', 'min_netbox_version',
|
||||
'version', 'download_url', 'sha256', 'artifact_size', 'artifact_kind', 'artifact_filename', 'commit_sha', 'min_netbox_version',
|
||||
'max_netbox_version', 'published_at', 'approved', 'status', 'immutable', 'approved_payload_sha256',
|
||||
];
|
||||
$pluginKeys = [
|
||||
@@ -484,6 +490,9 @@ test('public and admin templates render safely with complete artifact evidence',
|
||||
'title' => 'Demo', 'plugin' => $state['plugins'][0], 'source' => $state['sources'][0], 'releases' => $state['releases'],
|
||||
]);
|
||||
assertTrue(str_contains($detail, 'Wheel'));
|
||||
$installation = $view->render('installation', $common + ['title' => 'Installation']);
|
||||
assertTrue(str_contains($installation, 'git+https://git.mrblake.cc/MrBlake/Netbox-Store.git'));
|
||||
assertTrue(str_contains($installation, 'https://netbox.mrblake.cc'));
|
||||
$admin = $view->render('admin/dashboard', [
|
||||
'title' => 'Admin', 'currentPath' => '/admin', 'adminEnabled' => true, 'adminUser' => 'admin',
|
||||
'csrf' => 'safe-token', 'ok' => '', 'error' => '', 'sources' => $state['sources'],
|
||||
@@ -824,9 +833,12 @@ test('sync preserves overrides, rehashes replacements, withdraws removals and ar
|
||||
});
|
||||
$adapter->releases = [];
|
||||
$service->syncSource('source-sync');
|
||||
$withdrawn = $repository->read()['releases'][0];
|
||||
$fallbackState = $repository->read();
|
||||
$withdrawn = $fallbackState['releases'][0];
|
||||
assertTrue($withdrawn['withdrawn']);
|
||||
assertSame('pending', $withdrawn['status']);
|
||||
assertSame('source_archive', $fallbackState['releases'][1]['artifactKind']);
|
||||
assertSame('source:' . str_repeat('c', 40), $fallbackState['releases'][1]['externalId']);
|
||||
|
||||
$adapter->files = [];
|
||||
$service->syncSource('source-sync');
|
||||
|
||||
Reference in New Issue
Block a user