-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors-bad-attribute-reference.yml
More file actions
59 lines (53 loc) · 2.1 KB
/
Copy patherrors-bad-attribute-reference.yml
File metadata and controls
59 lines (53 loc) · 2.1 KB
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
---
name: bad attribute reference errors - <NAME>
specifications:
- spec: "ATREF"
number: "1.1.1"
summary: "non-conforming strings are not valid attribute references"
parameters:
- NAME: clause with no attribute
CLAUSE: { "op": "in", "values": [""] }
CONTEXT: { kind: "user", key: "user-key" }
- NAME: empty path component
CLAUSE: { contextKind: "user", "attribute": "///", "op": "in", "values": [""] }
CONTEXT: { kind: "user", key: "user-key" }
- NAME: tilde followed by invalid escape character
# The SDK should reject this attribute reference as malformed. If it instead treats the tilde as a
# literal character and matches the attribute "a~b", that's wrong.
CLAUSE: { contextKind: "user", "attribute": "/a~b", "op": "in", "values": [true] }
CONTEXT: { kind: "user", key: "user-key", "a~b": true }
- NAME: tilde followed by nothing
# The SDK should reject this attribute reference as malformed. If it instead treats the tilde as a
# literal character and matches the attribute "a~", that's wrong.
CLAUSE: { contextKind: "user", "attribute": "/a~", "op": "in", "values": [true] }
CONTEXT: { kind: "user", key: "user-key", "a~": true }
sdkData:
flags:
test-flag:
variations:
- "WRONG! flag returned off variation, this definitely shouldn't be possible"
- "WRONG! flag returned fallthrough, this definitely shouldn't be possible"
- "WRONG! the malformed clause somehow matched"
- "WRONG! the malformed clause was treated as a regular non-match, so the next rule matched"
on: true
offVariation: 0
fallthrough: { variation: 1 }
rules:
- id: rule-with-malformed-clause
variation: 2
clauses:
- <CLAUSE>
- id: rule-that-always-matches
variation: 3
clauses:
- attribute: "key"
op: "in"
values: [""]
negate: true
evaluations:
- flagKey: test-flag
context: <CONTEXT>
default: "default"
expect:
value: "default"
reason: { kind: "ERROR", errorKind: "MALFORMED_FLAG" }