| 1 |
/* |
| 2 |
* Mock "available updates" entries for interactively testing layout changes with large updates |
| 3 |
* To use it, import it in updates.jsx: |
| 4 |
* |
| 5 |
* import { injectMockUpdates } from "./mock-updates.js"; |
| 6 |
* |
| 7 |
* and call it in loadUpdates()'s then Handler: |
| 8 |
* |
| 9 |
* .then(() => { |
| 10 |
* injectMockUpdates(updates); |
| 11 |
* let pkg_ids = Object.keys(updates); |
| 12 |
*/ |
| 13 |
|
| 14 |
export function injectMockUpdates(updates) { |
| 15 |
// some security updates |
| 16 |
updates["security-crit;2.3-4"] = { |
| 17 |
name: "security-crit", |
| 18 |
version: "2.3-4", |
| 19 |
bug_urls: [], |
| 20 |
cve_urls: ["https://cve.example.com?name=CVE-2014-123456", "https://cve.example.com?name=CVE-2017-9999"], |
| 21 |
vendor_urls: ["https://access.redhat.com/security/updates/classification/#critical", "critical", |
| 22 |
"https://access.redhat.example.com/errata/RHSA-2000:0001", "https://access.redhat.example.com/errata/RHSA-2000:0002"], |
| 23 |
severity: 8, |
| 24 |
description: "This will wreck your data center!", |
| 25 |
}; |
| 26 |
updates["security-low;1-2+sec1"] = { |
| 27 |
name: "security-low", |
| 28 |
version: "1-2+sec1", |
| 29 |
bug_urls: [], |
| 30 |
cve_urls: ["https://cve.example.com?name=CVE-2014-54321"], |
| 31 |
vendor_urls: ["https://access.redhat.com/security/updates/classification/#bogus", "bogus", |
| 32 |
"https://access.redhat.com/security/updates/classification/#low", "low"], |
| 33 |
severity: 8, |
| 34 |
description: "Mostly Harmless", |
| 35 |
}; |
| 36 |
updates["security-imp;5-2"] = { |
| 37 |
name: "security-imp", |
| 38 |
version: "5-2", |
| 39 |
bug_urls: [], |
| 40 |
vendor_urls: ["https://access.redhat.com/security/updates/classification/#low", "low", |
| 41 |
"https://access.redhat.com/security/updates/classification/#important", "important"], |
| 42 |
severity: 8, |
| 43 |
description: "This update will make you sleep more peacefully.", |
| 44 |
}; |
| 45 |
updates["security-mod;12.3-4"] = { |
| 46 |
name: "security-mod", |
| 47 |
version: "12.3-4", |
| 48 |
bug_urls: [], |
| 49 |
vendor_urls: ["https://access.redhat.com/security/updates/classification/#moderate", "moderate"], |
| 50 |
severity: 8, |
| 51 |
description: "This update will make you sleep more peacefully.", |
| 52 |
}; |
| 53 |
// no vendor URLs, default severity |
| 54 |
updates["security-default;42"] = { |
| 55 |
name: "security-default", |
| 56 |
version: "42", |
| 57 |
cve_urls: ["https://cve.example.com?name=CVE-2014-54321"], |
| 58 |
vendor_urls: [], |
| 59 |
severity: 8, |
| 60 |
description: "Yet another weakness fixed.", |
| 61 |
}; |
| 62 |
|
| 63 |
// source with many binaries |
| 64 |
for (let i = 1; i < 50; ++i) { |
| 65 |
const name = `manypkgs${i}`; |
| 66 |
updates[name + ";1-1"] = { |
| 67 |
name, |
| 68 |
version: "1-1", |
| 69 |
bug_urls: [], |
| 70 |
cve_urls: [], |
| 71 |
severity: 4, |
| 72 |
description: "Make [everything](http://everything.example.com) *better*\n\n * more packages\n * more `bugs`\n * more fun!", |
| 73 |
markdown: true, |
| 74 |
}; |
| 75 |
} |
| 76 |
|
| 77 |
// long changelog |
| 78 |
updates["verbose;1-1"] = { |
| 79 |
name: "verbose", |
| 80 |
version: "1-1", |
| 81 |
bug_urls: [], |
| 82 |
cve_urls: [], |
| 83 |
severity: 6, |
| 84 |
description: ("Some longish explanation of some boring technical change. " + |
| 85 |
"This is total technobabble gibberish for layman users.\n\n").repeat(30) |
| 86 |
}; |
| 87 |
|
| 88 |
updates["verbose-md;1-1"] = { |
| 89 |
name: "verbose-md", |
| 90 |
version: "1-1", |
| 91 |
bug_urls: [], |
| 92 |
cve_urls: [], |
| 93 |
severity: 6, |
| 94 |
description: ("Some longish explanation of some *boring* technical change. " + |
| 95 |
"This is total technobabble gibberish for layman users.\n\n").repeat(30), |
| 96 |
markdown: true, |
| 97 |
}; |
| 98 |
|
| 99 |
// many bug fixes |
| 100 |
const bugs = []; |
| 101 |
for (let i = 10000; i < 10025; ++i) |
| 102 |
bugs.push("http://bugzilla.example.com/" + i); |
| 103 |
updates["buggy;1-1"] = { |
| 104 |
name: "buggy", |
| 105 |
version: "1-1", |
| 106 |
bug_urls: bugs, |
| 107 |
cve_urls: [], |
| 108 |
severity: 6, |
| 109 |
description: "This is FUBAR", |
| 110 |
}; |
| 111 |
} |