Store license information for packages
And display this on the package page. This uses a couple of new tables, and an additional field in the package_metadata table. Currently, the order of the licenses in the package definition isn't stored, as I'm not sure the order in the list is significant.
This commit is contained in:
parent
28c2d46081
commit
16799a34a9
12 changed files with 393 additions and 16 deletions
42
tests/model-license.scm
Normal file
42
tests/model-license.scm
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
(define-module (tests model-license)
|
||||
#:use-module (srfi srfi-64)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (guix tests)
|
||||
#:use-module (guix-data-service database)
|
||||
#:use-module (tests mock-inferior)
|
||||
#:use-module (guix-data-service model license))
|
||||
|
||||
(test-begin "test-model-license")
|
||||
|
||||
(mock
|
||||
((guix-data-service model license)
|
||||
inferior-packages->license-data
|
||||
(lambda (inf packages)
|
||||
'((("License 1"
|
||||
"https://gnu.org/licenses/test-1.html"
|
||||
"https://example.com/why-license-1"))
|
||||
(("License 1"
|
||||
"https://gnu.org/licenses/test-1.html"
|
||||
"https://example.com/why-license-1")
|
||||
("License 2"
|
||||
"https://gnu.org/licenses/test-2.html"
|
||||
"https://example.com/why-license-2")))))
|
||||
|
||||
(with-postgresql-connection
|
||||
(lambda (conn)
|
||||
(with-postgresql-transaction
|
||||
conn
|
||||
(lambda (conn)
|
||||
(test-assert "works"
|
||||
(inferior-packages->license-id-lists conn #f #f)))
|
||||
#:always-rollback? #t)
|
||||
|
||||
(with-postgresql-transaction
|
||||
conn
|
||||
(lambda (conn)
|
||||
(test-equal "works repeatedly"
|
||||
(inferior-packages->license-id-lists conn #f #f)
|
||||
(inferior-packages->license-id-lists conn #f #f)))
|
||||
#:always-rollback? #t))))
|
||||
|
||||
(test-end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue