tests: update some unit tests to the last changes.
This commit is contained in:
parent
0ffc8f9fa6
commit
6400bc725c
3 changed files with 64 additions and 9 deletions
|
|
@ -253,12 +253,58 @@ dbus send bus=session path=/org/freedesktop/DBus
|
|||
member={Hello,AddMatch,RemoveMatch,GetNameOwner,NameHasOwner,StartServiceByName}
|
||||
peer=(name=org.freedesktop.DBus, label=dbus-session//&unconfined),
|
||||
|
||||
}`,
|
||||
},
|
||||
{
|
||||
name: "base-strict-1",
|
||||
b: Builders["base-strict"],
|
||||
profile: `
|
||||
profile foo {
|
||||
include <abstractions/base>
|
||||
}`,
|
||||
want: `
|
||||
profile foo {
|
||||
include <abstractions/base-strict>
|
||||
}`,
|
||||
},
|
||||
{
|
||||
name: "attach-1",
|
||||
b: Builders["attach"],
|
||||
profile: `
|
||||
profile attach-1 flags=(attach_disconnected) {
|
||||
include <abstractions/base>
|
||||
include <abstractions/base-strict>
|
||||
include <abstractions/consoles>
|
||||
}`,
|
||||
want: `
|
||||
@{att} = /att/attach-1/
|
||||
profile attach-1 flags=(attach_disconnected,attach_disconnected.path=@{att}) {
|
||||
include <abstractions/attached/base>
|
||||
include <abstractions/attached/base>
|
||||
include <abstractions/attached/consoles>
|
||||
}`,
|
||||
},
|
||||
{
|
||||
name: "attach-2",
|
||||
b: Builders["attach"],
|
||||
profile: `
|
||||
profile attach-2 flags=(complain) {
|
||||
include <abstractions/base>
|
||||
include <abstractions/base-strict>
|
||||
include <abstractions/consoles>
|
||||
}`,
|
||||
want: `
|
||||
@{att} = ""
|
||||
profile attach-2 flags=(complain) {
|
||||
include <abstractions/base>
|
||||
include <abstractions/base-strict>
|
||||
include <abstractions/consoles>
|
||||
}`,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
opt := &Option{File: prebuild.RootApparmord.Join(tt.name)}
|
||||
opt := &Option{File: prebuild.RootApparmord.Join(tt.name), Name: tt.name}
|
||||
got, err := tt.b.Apply(opt, tt.profile)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("Builder.Apply() error = %v, wantErr %v", err, tt.wantErr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue