Skip to content

Commit b9567d4

Browse files
authored
Merge pull request #49 from chkware/release/ready-v0.4.0
Release/ready v0.4.0
2 parents e331e6c + ce3e750 commit b9567d4

18 files changed

Lines changed: 1610 additions & 865 deletions

docs/02-setup.md

Lines changed: 0 additions & 89 deletions
This file was deleted.

docs/05-References/050-concepts.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/05-References/051-http-reference.md

Lines changed: 0 additions & 107 deletions
This file was deleted.
Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Http spec. examples
2+
title: Http examples
33
---
44

55
:::note
@@ -8,11 +8,10 @@ title: Http spec. examples
88
:::
99

1010
:::note
11-
Case-wise more example can be found in `tests/resources/storage/sample_config` directory of [https://github.com/chkware/cli](https://github.com/chkware/cli/tree/main/tests/resources/storage/sample_config) repository
11+
Case-wise more example can be found in [https://github.com/chkware/cli](https://github.com/chkware/cli/tree/main/tests/resources/storage/sample_config) repository
1212
:::
1313

14-
15-
## Request examples
14+
[Http specification document reference](/references/http-reference)
1615

1716
Following examples are using HTTP _GET_ and _POST_ method. Although all these example are still valid for _POST_, _PUT_, _PATCH_, _DELETE_, _OPTIONS_, _HEAD_ method as well. You can still send a request body with _GET_ or _HEAD_ method for the sake of testing API.
1817

@@ -255,54 +254,3 @@ request:
255254
</book>
256255
</catalog>
257256
```
258-
259-
---
260-
## Request using variable examples
261-
262-
We can also use variables inside a http specification file. See examples below.
263-
264-
** * This is highly experimental. Report any bug you can find.**
265-
266-
### Request with query string using variables
267-
268-
```yaml
269-
---
270-
version: default:http:0.7.2
271-
272-
# define local variables
273-
variables:
274-
Foo: 'bar'
275-
Two: 2
276-
Server: https://example.org/api
277-
278-
request:
279-
# put variables on the path for query string
280-
url: {$Server}/path?foo={$Foo}&two={$Two}
281-
method: GET
282-
```
283-
284-
### Request with basic authentication header using variables
285-
286-
```yaml
287-
---
288-
version: default:http:0.7.2
289-
290-
# define local variables
291-
variables:
292-
userName: Some_USER
293-
password: Some-P@$$W03D
294-
content_type: application/json
295-
Server: https://example.org/api
296-
297-
request:
298-
url: {$Server}/resource/id
299-
method: GET
300-
301-
headers:
302-
Accept-Encoding: gzip, deflate
303-
Content-Type: {$content_type}
304-
305-
auth[basic]:
306-
username: {$userName}
307-
password: {$password}
308-
```

docs/examples/testcase-examples.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: Testcase examples
3+
---
4+
5+
:::note
6+
- This page should be use as reference for specification files.
7+
- This page is subject to change. It is requested to check this page frequently.
8+
:::
9+
10+
:::note
11+
Case-wise more example can be found in [https://github.com/chkware/cli](https://github.com/chkware/cli/blob/main/tests/resources/storage/sample_config/bitcoin-usd-testcase.chk) repository
12+
:::
13+
14+
[Testcase specification document reference](/references/testcase-reference)
15+
16+
Testcase is an experimental feature, in _`PRE_ALPHA`_ stage.
17+
18+
### Testcase with in-file request
19+
20+
```yaml
21+
---
22+
version: 'default:testcase:0.7.2'
23+
24+
variables:
25+
Name: 'Morpheus'
26+
Job: 'leader'
27+
Response: ~
28+
Server: https://reqres.in/api/v1
29+
30+
request:
31+
url: "{$Server}/users"
32+
method: POST
33+
body[json]: {
34+
'name': $Name,
35+
'job': $Job,
36+
}
37+
return: ~
38+
39+
spec:
40+
execute:
41+
file: ~
42+
result: $Response
43+
44+
asserts:
45+
- {type: AssertEqual, actual: $Response.code, expected: 201}
46+
- {type: AssertIsMap, actual: $Response.body}
47+
```
48+
49+
Assertion [reference with examples](/references/testcase-reference#assertions) can be found here.

0 commit comments

Comments
 (0)