feat: lizenz aendern - PATCH /api/v1/licenses/:key
- Aendert max_activations (z.B. -1 unbegrenzt), email, note, expires_at, status. - Partielles Update, validiert; nur erlaubte Felder. Tests + README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -215,6 +215,19 @@ try {
|
||||
const fuLocal = await admin('POST', '/api/v1/releases/from-url', { product: P, version: '1.2.0', zip_url: 'http://127.0.0.1/a.zip' });
|
||||
ok('from-url private host → 400', fuLocal.status === 400, JSON.stringify(fuLocal.json));
|
||||
|
||||
// ── Modify a license (PATCH) ──
|
||||
// key1 is max=1 (1 domain bound). Switch it to unlimited and prove it works.
|
||||
const patch = await admin('PATCH', `/api/v1/licenses/${key1}`, { max_activations: -1 });
|
||||
ok('patch to unlimited', patch.status === 200 && patch.json.max_activations === -1, JSON.stringify(patch.json));
|
||||
const extra = await pub('/api/v1/activate', { key: key1, product: P, domain: 'extra.de' });
|
||||
ok('after unlimited, extra domain activates', extra.json.status === 'valid', JSON.stringify(extra.json));
|
||||
|
||||
const patchBad = await admin('PATCH', `/api/v1/licenses/${key1}`, { max_activations: 0 });
|
||||
ok('patch bad value → 400', patchBad.status === 400, JSON.stringify(patchBad.json));
|
||||
|
||||
const patchUnknown = await admin('PATCH', '/api/v1/licenses/ZZZZ-ZZZZ-ZZZZ-ZZZZ', { max_activations: 3 });
|
||||
ok('patch unknown key → 404', patchUnknown.status === 404, JSON.stringify(patchUnknown.json));
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
fail++;
|
||||
|
||||
Reference in New Issue
Block a user