From 00206f4dfbb55cc56d24bdfd9f015e912120c72c Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Tue, 1 Feb 2022 08:45:27 -0500 Subject: internal/feed: add v3userinteraction tests --- internal/feed/feed.go | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'internal/feed/feed.go') diff --git a/internal/feed/feed.go b/internal/feed/feed.go index 4b18b9d..98e62ef 100644 --- a/internal/feed/feed.go +++ b/internal/feed/feed.go @@ -29,32 +29,6 @@ const ( // TODO: parse cpe -// CVSS user interaction -type UserInteraction int - -// Unmarshal CVSS user interaction from JSON. -func (me *UserInteraction) UnmarshalJSON(b []byte) error { - // decode string, check for error - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - - // check value - switch s { - case "NONE": - *me = None - case "REQUIRED": - *me = Required - default: - // return error - return fmt.Errorf("unknown user interaction: %s", s) - } - - // return success - return nil -} - // CVSS scope type Scope int @@ -432,7 +406,7 @@ type CvssV3 struct { PrivilegesRequired V3PrivilegesRequired `json:"privilegesRequired"` // user interaction - UserInteraction UserInteraction `json:"userInteraction"` + UserInteraction V3UserInteraction `json:"userInteraction"` // scope Scope Scope `json:"scope"` -- cgit v1.2.3