...
1
2 package devices
3
4 import (
5 . "github.com/onsi/ginkgo/v2"
6 . "github.com/onsi/gomega"
7 )
8
9 var _ = Describe("Device Properties and Attributes Matcher", func() {
10 It("Match against SUBSYSTEM property", func() {
11 m := NewMatcher().WithRules(NewPropRule("SUBSYSTEM", "usb"))
12 match := m.MatchDevice(testDevice)
13 Expect(match).To(BeTrue())
14 })
15
16 It("Match against idVendor and idProduct attributes", func() {
17 m := NewMatcher().WithRules(NewAttrRule("idProduct", "0002"), NewAttrRule("idVendor", "1d6b"))
18 match := m.MatchDevice(testDevice)
19 Expect(match).To(BeTrue())
20 })
21
22 It("Match against DEVNAME property", func() {
23 m := NewMatcher().WithRules(NewPropRule("DEVNAME", "bus/usb/001/001"))
24 match := m.MatchDevice(testDevice)
25 Expect(match).To(BeTrue())
26 })
27 })
28
View as plain text