summaryrefslogtreecommitdiffstats
path: root/src/tests/keywords/update-filter
blob: 30f96bef9f49e9a35bffb4c87d8df4808202abbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#
#  PRE: update
#
update control {
	Tmp-Integer-0 := 5
	Tmp-Integer-0 += 10
	Tmp-Integer-0 += 15
	Tmp-Integer-0 += 20
	Tmp-String-0 := 'foo'
	Tmp-String-0 += 'baz'
	Tmp-String-0 += 'boink'
}

#
#  Reset the request list
#
update {
	&request: !* ANY
	&request: += &control:[*]
}

debug_request

#
#  Only matching attributes of the specified type should remain
#
update request {
	&Tmp-Integer-0 == 10
}

if (&Tmp-Integer-0[0] != 10) {
	update reply {
		Filter-Id += "fail 1"
	}
}

if ("%{Tmp-Integer-0[#]}" != 1) {
	update reply {
		Filter-Id += "fail 2"
	}
}

if ("%{Tmp-String-0[#]}" != 3) {
	update reply {
		Filter-Id += "fail 3"
	}
}

debug_request

#
#  Only matching attributes of the specified type should remain
#
update request {
	&Tmp-String-0 == 'baz'
}

if (&Tmp-String-0[0] != 'baz') {
	update reply {
		Filter-Id += "fail 4"
	}
}

if ("%{Tmp-String-0[#]}" != 1) {
	update reply {
		Filter-Id += "fail 5"
	}
}

update {
	control:Auth-Type := Accept
	reply:Filter-Id := "filter"
}

debug_request