mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	Add ETAPI tests to repro inherited attribute issue and workaround
This commit is contained in:
		
							parent
							
								
									d26a0fae17
								
							
						
					
					
						commit
						9e5a02094c
					
				
							
								
								
									
										67
									
								
								test-etapi/get-inherited-attribute-workaround.http
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								test-etapi/get-inherited-attribute-workaround.http
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,67 @@
 | 
			
		||||
POST {{triliumHost}}/etapi/attributes
 | 
			
		||||
Authorization: {{authToken}}
 | 
			
		||||
Content-Type: application/json
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  "noteId": "root",
 | 
			
		||||
  "type": "label",
 | 
			
		||||
  "name": "mylabel",
 | 
			
		||||
  "value": "val",
 | 
			
		||||
  "isInheritable": true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
> {% client.global.set("createdInheritedAttributeId", response.body.attributeId); %}
 | 
			
		||||
 | 
			
		||||
###
 | 
			
		||||
 | 
			
		||||
POST {{triliumHost}}/etapi/create-note
 | 
			
		||||
Authorization: {{authToken}}
 | 
			
		||||
Content-Type: application/json
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  "parentNoteId": "root",
 | 
			
		||||
  "title": "Hello",
 | 
			
		||||
  "type": "text",
 | 
			
		||||
  "content": "Hi there!"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
> {%
 | 
			
		||||
client.global.set("createdNoteId", response.body.note.noteId);
 | 
			
		||||
client.global.set("createdBranchId", response.body.branch.branchId);
 | 
			
		||||
%}
 | 
			
		||||
 | 
			
		||||
###
 | 
			
		||||
 | 
			
		||||
POST {{triliumHost}}/etapi/attributes
 | 
			
		||||
Authorization: {{authToken}}
 | 
			
		||||
Content-Type: application/json
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  "noteId": "{{createdNoteId}}",
 | 
			
		||||
  "type": "label",
 | 
			
		||||
  "name": "mylabel",
 | 
			
		||||
  "value": "val",
 | 
			
		||||
  "isInheritable": false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
> {% client.global.set("createdOwnedAttributeId", response.body.attributeId); %}
 | 
			
		||||
 | 
			
		||||
###
 | 
			
		||||
 | 
			
		||||
DELETE {{triliumHost}}/etapi/attributes/{{createdOwnedAttributeId}}
 | 
			
		||||
Authorization: {{authToken}}
 | 
			
		||||
 | 
			
		||||
> {% client.assert(response.status === 204); %}
 | 
			
		||||
 | 
			
		||||
###
 | 
			
		||||
 | 
			
		||||
GET {{triliumHost}}/etapi/notes/{{createdNoteId}}
 | 
			
		||||
Authorization: {{authToken}}
 | 
			
		||||
 | 
			
		||||
> {%
 | 
			
		||||
client.assert(response.status === 200);
 | 
			
		||||
client.assert(response.body.noteId == client.global.get("createdNoteId"));
 | 
			
		||||
client.assert(response.body.attributes.length == 1);
 | 
			
		||||
client.assert(response.body.attributes[0].attributeId == 
 | 
			
		||||
  client.global.get("createdInheritedAttributeId"));
 | 
			
		||||
%}
 | 
			
		||||
							
								
								
									
										44
									
								
								test-etapi/get-inherited-attribute.http
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								test-etapi/get-inherited-attribute.http
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,44 @@
 | 
			
		||||
POST {{triliumHost}}/etapi/attributes
 | 
			
		||||
Authorization: {{authToken}}
 | 
			
		||||
Content-Type: application/json
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  "noteId": "root",
 | 
			
		||||
  "type": "label",
 | 
			
		||||
  "name": "mylabel",
 | 
			
		||||
  "value": "val",
 | 
			
		||||
  "isInheritable": true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
> {% client.global.set("createdAttributeId", response.body.attributeId); %}
 | 
			
		||||
 | 
			
		||||
###
 | 
			
		||||
 | 
			
		||||
POST {{triliumHost}}/etapi/create-note
 | 
			
		||||
Authorization: {{authToken}}
 | 
			
		||||
Content-Type: application/json
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  "parentNoteId": "root",
 | 
			
		||||
  "title": "Hello",
 | 
			
		||||
  "type": "text",
 | 
			
		||||
  "content": "Hi there!"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
> {%
 | 
			
		||||
client.global.set("createdNoteId", response.body.note.noteId);
 | 
			
		||||
client.global.set("createdBranchId", response.body.branch.branchId);
 | 
			
		||||
%}
 | 
			
		||||
 | 
			
		||||
###
 | 
			
		||||
 | 
			
		||||
GET {{triliumHost}}/etapi/notes/{{createdNoteId}}
 | 
			
		||||
Authorization: {{authToken}}
 | 
			
		||||
 | 
			
		||||
> {%
 | 
			
		||||
client.assert(response.status === 200);
 | 
			
		||||
client.assert(response.body.noteId == client.global.get("createdNoteId"));
 | 
			
		||||
client.assert(response.body.attributes.length == 1);
 | 
			
		||||
client.assert(response.body.attributes[0].attributeId == 
 | 
			
		||||
  client.global.get("createdAttributeId"));
 | 
			
		||||
%}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user