Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
app: dpplint
containers:
- name: dpplint
image: oydeu/dpplint@sha256:b2a3830a66ec00ccc36eff0e4fd6f52c74cb7da1cd864ca1ac711a735f27b5a1
image: oydeu/dpplint@sha256:bf49962f61eea1998486462af28dc504a0b1f09143554ecf518eeb9298f59094
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
Expand Down
29 changes: 28 additions & 1 deletion test/integration/validations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,40 @@ def criterion(result, id) = result["criteria"].find { |c| c["id"] == id }
assert_equal "failed", criterion(lint(reference.merge("uniqueProductIdentifier" => long)), "DPP-REG-024")["result"]
end

test "value data type that EN 18223 excludes fails" do
assert_equal "passed", criterion(lint(reference), "DPP-DAT-026")["result"]
passport = reference
passport["elements"][0]["elements"][0]["valueDataType"] = "xsd:token"
result = criterion(lint(passport), "DPP-DAT-026")
assert_equal "failed", result["result"]
assert_match(/derived from string/, result["messages"].first["message"])
end

test "identifiers outside ISO/IEC 646 or the URI syntax fail" do
assert_equal "passed", criterion(lint(reference), "DPP-ID-015")["result"]
passport = reference.merge("uniqueProductIdentifier" => "https://dpp.example.org/01/04012345000016/21/\u00c41")
assert_equal "failed", criterion(lint(passport), "DPP-ID-015")["result"], "non-ASCII character"
passport = reference.merge("economicOperatorId" => "did:web:example.org:operator 1")
assert_equal "failed", criterion(lint(passport), "DPP-ID-015")["result"], "space in a URI"
passport = reference.merge("uniqueProductIdentifier" => "https://dpp.example.org/01/04012345000016/21/A%C3%841")
assert_equal "passed", criterion(lint(passport), "DPP-ID-015")["result"], "percent-encoded"
end

test "product DID with another method than did:web, did:ethr or did:ebsi gives a warning" do
assert_equal "skipped", criterion(lint(reference), "DPP-ID-054")["result"], "product identifier is no DID"
result = criterion(lint(reference.merge("uniqueProductIdentifier" => "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK")), "DPP-ID-054")
assert_equal "warning", result["result"]
assert_match(/did:web, did:ethr or did:ebsi/, result["messages"].first["message"])
assert_equal "passed", criterion(lint(reference.merge("uniqueProductIdentifier" => "did:web:dpp.example.org:product:4711")), "DPP-ID-054")["result"]
end

test "optional facility identifier is skipped when absent" do
assert_equal "skipped", criterion(lint(reference), "DPP-ID-010")["result"]
end

test "checks that request the product identifier need one" do
result = lint(reference)
%w[DPP-ID-001 DPP-ID-013 DPP-DAT-003 DPP-DAT-016 DPP-SEC-014].each do |id|
%w[DPP-ID-001 DPP-ID-013 DPP-DAT-003 DPP-DAT-016 DPP-SEC-014 DPP-SEC-020].each do |id|
assert_equal "skipped", criterion(result, id)["result"], id
end
assert_equal "rated by dpp-validator from its daily runs", criterion(result, "DPP-ID-002")["reason"]
Expand Down
Loading