}
			}
			ms[i] = m
		}
		c.Assert(checkers.InferDeclared(ms), jc.DeepEquals, test.expect)
	}
}

var operationCheckerTests = []struct {
	about       string
	caveat      checkers.Caveat
	oc          checkers.OperationChecker
	expectError string
}{{
	about:  "allowed operation",
	caveat: checkers.AllowCaveat("op1", "op2", "op3"),
	oc:     checkers.OperationChecker("op1"),
}, {
	about:  "not denied oc",
	caveat: checkers.DenyCaveat("op1", "op2", "op3"),
	oc:     checkers.OperationChecker("op4"),
}, {
	about:       "not allowed oc",
	caveat:      checkers.AllowCaveat("op1", "op2", "op3"),
	oc:          checkers.OperationChecker("op4"),
	expectError: "op4 not allowed",
}, {
	about:       "denied oc",
	caveat:      checkers.DenyCaveat("op1", "op2", "op3"),
	oc:          checkers.OperationChecker("op1"),
	expectError: "op1 not allowed",
Exemple #2
0
			Id: checkers.TimeBeforeCaveat(t2).Condition,
		},
		macaroon.Caveat{
			Id: checkers.TimeBeforeCaveat(t1).Condition,
		},
	},
	expectTime:    t1,
	expectExpires: true,
}, {
	about: "mixed caveats",
	caveats: []macaroon.Caveat{
		macaroon.Caveat{
			Id: checkers.TimeBeforeCaveat(t1).Condition,
		},
		macaroon.Caveat{
			Id: checkers.AllowCaveat("abc").Condition,
		},
		macaroon.Caveat{
			Id: checkers.TimeBeforeCaveat(t2).Condition,
		},
		macaroon.Caveat{
			Id: checkers.DenyCaveat("def").Condition,
		},
	},
	expectTime:    t1,
	expectExpires: true,
}, {
	about: "invalid time-before caveat",
	caveats: []macaroon.Caveat{
		macaroon.Caveat{
			Id: checkers.CondTimeBefore + " tomorrow",