2 Suite Teardown Kill The Tree ${CONTROLLER} InCSE1 admin admin
3 Library ../../../libraries/criotdm.py
7 ${httphost} ${CONTROLLER}
12 ${rt_contentInstance} 4
16 [Documentation] set a suite variable ${iserver}
17 #==================================================
18 # Container Mandatory Attribute Test
19 #==================================================
20 # mandatory attribute: content
26 ${iserver} = Connect To Iotdm ${httphost} ${httpuser} ${httppass} http
27 Set Suite Variable ${iserver}
29 1.1 After Created, test whether all the mandatory attribtues are exist.
30 [Documentation] create 1 conIn test whether all the mandatory attribtues are exist
31 ${attr} = Set Variable
32 ${r}= Create Resource ${iserver} InCSE1 ${rt_container} ${attr} Container1
33 ${container} = Name ${r}
34 ${status_code} = Status Code ${r}
35 Should Be Equal As Integers ${status_code} 201
36 ${attr} = Set Variable "con":"102CSS"
37 Create Resource ${iserver} InCSE1/Container1 ${rt_contentInstance} ${attr} conIn1
39 Should Contain ${text} "ri": "rn": "cs":
40 Should Contain ${text} "lt": "pi": "con":
41 Should Contain ${text} "ct": "rty":4
42 Should Not Contain S{text} "lbl" "creator" "or"
44 1.21 Missing content should return error
45 [Documentation] Missing content should return error
46 ${attr} = Set Variable
47 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1/Container1 ${rt_contentInstance}
49 Should Start with ${error} Cannot create this resource [400]
50 Should Contain ${error} CONTENT missing
51 #===========================================================
52 # ContentInstance Optional Attribute Test (Allowed)
53 #===========================================================
56 # Optional attribute: [aa,at],contentInfo, ontologyRef, label, creator
58 2.11 ContentInfo (cnf) can be added when create
59 [Documentation] ContentInfo (cnf) can be added when create
60 ${attr} = Set Variable "cnf": "1","con":"102CSS"
61 # create conIn under Container1
62 ${r}= Create Resource ${iserver} InCSE1/Container1 ${rt_contentInstance} ${attr} conIn2
63 ${text} = Check Create and Retrieve ContentInstance ${r}
64 Should Contain ${text} cnf
66 Delete the ContenInstance 2.1
67 ${deleteRes} = Delete Resource ${iserver} InCSE1/Container1/conIn2
69 2.12 ContentInfo (cnf) cannot be updated
70 [Documentation] ContentInfo (cnf) cannot be updated
71 ${attr} = Set Variable "cnf": "1"
72 ${error} = Cannot Update ContentInstance Error ${attr}
73 Should Contain ${error} Not permitted to update content
75 2.21 OntologyRef (or) can be added when create
76 [Documentation] OntologyRef (or) can be added when create
77 ${attr} = Set Variable "or": "http://cisco.com","con":"102CSS"
78 # create conIn under Container1
79 ${r}= Create Resource ${iserver} InCSE1/Container1 ${rt_contentInstance} ${attr} conIn2
80 ${text} = Check Create and Retrieve ContentInstance ${r}
81 Should Contain ${text} or
83 Delete the ContenInstance 2.2
84 ${deleteRes} = Delete Resource ${iserver} InCSE1/Container1/conIn2
86 2.22 OntologyRef (or) cannot be updated
87 [Documentation] OntologyRef (or) cannot be updated
88 ${attr} = Set Variable "or": "1"
89 ${error} = Cannot Update ContentInstance Error ${attr}
90 Should Contain ${error} Not permitted to update content
92 2.31 labels[single] can be added when create
93 [Documentation] create conIn under Container1, labels[single] can be added when create
94 ${attr} = Set Variable "lbl":["ds"],"con":"102CSS"
95 ${r}= Create Resource ${iserver} InCSE1/Container1 ${rt_contentInstance} ${attr} conIn2
96 ${text} = Check Create and Retrieve ContentInstance ${r}
97 Should Contain ${text} lbl
99 Delete the ContenInstance 2.31
100 ${deleteRes} = Delete Resource ${iserver} InCSE1/Container1/conIn2
102 2.32 labels (single) cannot be updated
103 [Documentation] update labels then expect error
104 ${attr} = Set Variable "lbl":["1"]
105 ${error} = Cannot Update ContentInstance Error ${attr}
106 Should Contain ${error} Not permitted to update content
108 2.33 labels (multiple) can be added when create
109 [Documentation] labels (multiple) can be added when create
110 ${attr} = Set Variable "lbl":["http://cisco.com","dsds"],"con":"102CSS"
111 # create conIn under Container1
112 ${r}= Create Resource ${iserver} InCSE1/Container1 ${rt_contentInstance} ${attr} conIn2
113 ${text} = Check Create and Retrieve ContentInstance ${r}
114 Should Contain ${text} lbl
116 Delete the ContenInstance 2.33
117 ${deleteRes} = Delete Resource ${iserver} InCSE1/Container1/conIn2
119 2.34 labels (multiple) cannot be updated
120 [Documentation] labels (multiple) cannot be updated
121 ${attr} = Set Variable "lbl":["1"]
122 ${error} = Cannot Update ContentInstance Error ${attr}
123 Should Contain ${error} Not permitted to update content
124 #=================================================================
125 # contentInstance Disturbing Attribute Test, Not Allowed Update
126 #=================================================================
127 # using non-valid attribtue to create then expext error
129 3.11 Mulitiple labels should return error
130 [Documentation] Mulitiple labels should return error
131 ${attr} = Set Variable "con": "1", "lbl":["label1"],"lbl":["label2"]
132 ${error} = Cannot Craete ContentInstance Error ${attr}
133 Should Contain ${error} Duplicate lbl
135 3.12 Multiple creator should return error
136 [Documentation] Multiple creator should return error
137 ${attr} = Set Variable "con": "1", "cr":null, "cr":null
138 ${error} = Cannot Craete ContentInstance Error ${attr}
139 Should Contain ${error} Duplicate cr
141 3.13 Multiple contentInfo should return error
142 [Documentation] Multiple contentInfo should return error
143 ${attr} = Set Variable "con": "1", "cnf":"1","cnf":"2"
144 ${error} = Cannot Craete ContentInstance Error ${attr}
145 Should Contain ${error} Duplicate cnf
147 3.14 Multiple ontologyRef should return error
148 [Documentation] Multiple ontologyRef should return error
149 ${attr} = Set Variable "con": "1", "or":"http://cisco.com","or":"http://google.com"
150 ${error} = Cannot Craete ContentInstance Error ${attr}
151 Should Contain ${error} Duplicate or
153 3.15 Mulptiple content should return error
154 [Documentation] Mulptiple content should return error
155 ${attr} = Set Variable "con": "1", "con":"2313"
156 ${error} = Cannot Craete ContentInstance Error ${attr}
157 Should Contain ${error} Duplicate con
158 #----------------All attributes cannot be updated----------
160 3.21 resourceType cannot be updated.
161 [Documentation] update resourceType and expect error
162 ${attr} = Set Variable "rt": 3
163 ${error} = Cannot Update ContentInstance Error ${attr}
164 Should Contain ${error} Not permitted to update content
166 3.22 resourceId cannot be updated.
167 [Documentation] update resourceId and expect error
168 ${attr} = Set Variable "ri": "e4e43"
169 ${error} = Cannot Update ContentInstance Error ${attr}
170 Should Contain ${error} Not permitted to update content
172 3.23 resourceName cannot be updated.
173 [Documentation] update resourceName and expect error
174 ${attr} = Set Variable "rn": "4343"
175 ${error} = Cannot Update ContentInstance Error ${attr}
176 Should Contain ${error} Not permitted to update content
178 3.24 parentId cannot be updated.
179 [Documentation] update parentID and expect error
180 ${attr} = Set Variable "pi": "InCSE2/ERE"
181 ${error} = Cannot Update ContentInstance Error ${attr}
182 Should Contain ${error} Not permitted to update content
184 3.25 cretionTime cannot be updated.
185 [Documentation] update createTime and expect error
186 ${attr} = Set Variable "ct": "343434T34322"
187 ${error} = Cannot Update ContentInstance Error ${attr}
188 Should Contain ${error} Not permitted to update content
190 3.26 lastmodifiedTime cannot be updated.
191 [Documentation] update lt then expect error
192 ${attr} = Set Variable "lt": "434343T23232"
193 ${error} = Cannot Update ContentInstance Error ${attr}
194 Should Contain ${error} Not permitted to update content
196 3.27 contentSize cannot be updated.
197 [Documentation] update contentSize then expect error
198 ${attr} = Set Variable "cs": 232
199 ${error} = Cannot Update ContentInstance Error ${attr}
200 Should Contain ${error} Not permitted to update content
202 3.28 content cannot be updated
203 [Documentation] update content then expect error
204 ${attr} = Set Variable "con": "1"
205 ${error} = Cannot Update ContentInstance Error ${attr}
206 Should Contain ${error} Not permitted to update content
207 #==================================================
208 # Functional Attribute Test
209 #==================================================
215 #==================================================
217 #==================================================
219 Delete the test Container1
220 [Documentation] Delete the test Container1
221 ${deleteRes} = Delete Resource ${iserver} InCSE1/Container1
224 Cannot Update ContentInstance Error
226 ${error} = Run Keyword And Expect Error * update Resource ${iserver} InCSE1/Container1/conIn1 ${rt_contentInstance}
228 Should Start with ${error} Cannot update this resource [405]
231 Cannot Craete ContentInstance Error
233 ${error} = Run Keyword And Expect Error * create Resource ${iserver} InCSE1/Container1/conIn1 ${rt_contentInstance}
235 Should Start with ${error} Cannot create this resource [400]
238 Check Create and Retrieve ContentInstance
241 ${status_code} = Status Code ${r}
242 Should Be Equal As Integers ${status_code} 201
243 ${rr} = Retrieve Resource ${iserver} ${con}