mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-12-02 06:55:08 +03:00
Add test integ for diff
This commit is contained in:
parent
6913ce92e2
commit
2551b89080
89
integration/hurl/tests_failed/diff.err
Normal file
89
integration/hurl/tests_failed/diff.err
Normal file
@ -0,0 +1,89 @@
|
||||
error: Assert body value
|
||||
--> tests_failed/diff.hurl:6:1
|
||||
|
|
||||
| GET http://localhost:8000/diff/change/line1
|
||||
| ...
|
||||
6 |-{
|
||||
|+[
|
||||
| "first_name": "John",
|
||||
| "last_name": "Smith",
|
||||
| "is_alive": true,
|
||||
|
|
||||
|
||||
error: Assert body value
|
||||
--> tests_failed/diff.hurl:40:1
|
||||
|
|
||||
| GET http://localhost:8000/diff/change/line2
|
||||
| ...
|
||||
| {
|
||||
40 |- "first_name": "John",
|
||||
|+ "first_name": "Bob",
|
||||
| "last_name": "Smith",
|
||||
| "is_alive": true,
|
||||
| "age": 27,
|
||||
|
|
||||
|
||||
error: Assert status code
|
||||
--> tests_failed/diff.hurl:70:6
|
||||
|
|
||||
| GET http://localhost:8000/diff/change/line3
|
||||
70 | HTTP 200
|
||||
| ^^^ actual value is <404>
|
||||
|
|
||||
|
||||
error: Assert body value
|
||||
--> tests_failed/diff.hurl:108:1
|
||||
|
|
||||
| GET http://localhost:8000/diff/change/line4
|
||||
| ...
|
||||
| {
|
||||
| "first_name": "John",
|
||||
| "last_name": "Smith",
|
||||
108 |- "is_alive": true,
|
||||
|+ "is_alive": false,
|
||||
| "age": 27,
|
||||
| "address": {
|
||||
| "street_address": "21 2nd Street",
|
||||
|
|
||||
|
||||
error: Assert body value
|
||||
--> tests_failed/diff.hurl:142:1
|
||||
|
|
||||
| GET http://localhost:8000/diff/change/line5
|
||||
| ...
|
||||
| "first_name": "John",
|
||||
| "last_name": "Smith",
|
||||
| "is_alive": true,
|
||||
142 |- "age": 27,
|
||||
|+ "age": 28,
|
||||
| "address": {
|
||||
| "street_address": "21 2nd Street",
|
||||
| "city": "New York",
|
||||
|
|
||||
|
||||
error: Assert body value
|
||||
--> tests_failed/diff.hurl:174:1
|
||||
|
|
||||
| GET http://localhost:8000/diff/delete/line3
|
||||
| ...
|
||||
| {
|
||||
| "first_name": "John",
|
||||
174 |- "last_name": "Smith",
|
||||
| "is_alive": true,
|
||||
| "age": 27,
|
||||
| "address": {
|
||||
|
|
||||
|
||||
error: Assert body value
|
||||
--> tests_failed/diff.hurl:208:1
|
||||
|
|
||||
| GET http://localhost:8000/diff/add/line3
|
||||
| ...
|
||||
| {
|
||||
208 | "first_name": "John",
|
||||
|+ "middle_name": "Bob",
|
||||
| "last_name": "Smith",
|
||||
| "is_alive": true,
|
||||
| "age": 27,
|
||||
|
|
||||
|
1
integration/hurl/tests_failed/diff.exit
Normal file
1
integration/hurl/tests_failed/diff.exit
Normal file
@ -0,0 +1 @@
|
||||
4
|
235
integration/hurl/tests_failed/diff.hurl
Normal file
235
integration/hurl/tests_failed/diff.hurl
Normal file
@ -0,0 +1,235 @@
|
||||
# The expected JSON will be exactly the same for all the entries
|
||||
|
||||
GET http://localhost:8000/diff/change/line1
|
||||
HTTP 200
|
||||
```
|
||||
{
|
||||
"first_name": "John",
|
||||
"last_name": "Smith",
|
||||
"is_alive": true,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
```
|
||||
|
||||
GET http://localhost:8000/diff/change/line2
|
||||
HTTP 200
|
||||
```
|
||||
{
|
||||
"first_name": "John",
|
||||
"last_name": "Smith",
|
||||
"is_alive": true,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
```
|
||||
|
||||
GET http://localhost:8000/diff/change/line3
|
||||
HTTP 200
|
||||
```
|
||||
{
|
||||
"first_name": "John",
|
||||
"last_name": "Smith",
|
||||
"is_alive": true,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
```
|
||||
|
||||
GET http://localhost:8000/diff/change/line4
|
||||
HTTP 200
|
||||
```
|
||||
{
|
||||
"first_name": "John",
|
||||
"last_name": "Smith",
|
||||
"is_alive": true,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
```
|
||||
|
||||
GET http://localhost:8000/diff/change/line5
|
||||
HTTP 200
|
||||
```
|
||||
{
|
||||
"first_name": "John",
|
||||
"last_name": "Smith",
|
||||
"is_alive": true,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
GET http://localhost:8000/diff/delete/line3
|
||||
HTTP 200
|
||||
```
|
||||
{
|
||||
"first_name": "John",
|
||||
"last_name": "Smith",
|
||||
"is_alive": true,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
GET http://localhost:8000/diff/add/line3
|
||||
HTTP 200
|
||||
```
|
||||
{
|
||||
"first_name": "John",
|
||||
"last_name": "Smith",
|
||||
"is_alive": true,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
```
|
3
integration/hurl/tests_failed/diff.ps1
Executable file
3
integration/hurl/tests_failed/diff.ps1
Executable file
@ -0,0 +1,3 @@
|
||||
Set-StrictMode -Version latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
hurl --continue-on-error --no-color tests_failed/diff.hurl
|
232
integration/hurl/tests_failed/diff.py
Normal file
232
integration/hurl/tests_failed/diff.py
Normal file
@ -0,0 +1,232 @@
|
||||
from app import app
|
||||
|
||||
|
||||
@app.route("/diff/change/line1")
|
||||
def error_diff_change_line1():
|
||||
return """[
|
||||
"first_name": "John",
|
||||
"last_name": "Smith",
|
||||
"is_alive": true,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
@app.route("/diff/change/line2")
|
||||
def error_diff_change_line2():
|
||||
return """{
|
||||
"first_name": "Bob",
|
||||
"last_name": "Smith",
|
||||
"is_alive": true,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
@app.route("/diff/change/line1")
|
||||
def error_diff_change_line3():
|
||||
return """{
|
||||
"first_name": "John",
|
||||
"last_name": "Smiths",
|
||||
"is_alive": true,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
@app.route("/diff/change/line4")
|
||||
def error_diff_change_line4():
|
||||
return """{
|
||||
"first_name": "John",
|
||||
"last_name": "Smith",
|
||||
"is_alive": false,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
@app.route("/diff/change/line5")
|
||||
def error_diff_change_line5():
|
||||
return """{
|
||||
"first_name": "John",
|
||||
"last_name": "Smith",
|
||||
"is_alive": true,
|
||||
"age": 28,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
@app.route("/diff/delete/line3")
|
||||
def error_diff_delete_line3():
|
||||
return """{
|
||||
"first_name": "John",
|
||||
"is_alive": true,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
@app.route("/diff/add/line3")
|
||||
def error_diff_add_line3():
|
||||
return """{
|
||||
"first_name": "John",
|
||||
"middle_name": "Bob",
|
||||
"last_name": "Smith",
|
||||
"is_alive": true,
|
||||
"age": 27,
|
||||
"address": {
|
||||
"street_address": "21 2nd Street",
|
||||
"city": "New York",
|
||||
"state": "NY",
|
||||
"postal_code": "10021-3100"
|
||||
},
|
||||
"phone_numbers": [
|
||||
{
|
||||
"type": "home",
|
||||
"number": "212 555-1234"
|
||||
},
|
||||
{
|
||||
"type": "office",
|
||||
"number": "646 555-4567"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
"Catherine",
|
||||
"Thomas",
|
||||
"Trevor"
|
||||
],
|
||||
"spouse": null
|
||||
}
|
||||
"""
|
3
integration/hurl/tests_failed/diff.sh
Executable file
3
integration/hurl/tests_failed/diff.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
hurl --continue-on-error --no-color tests_failed/diff.hurl
|
Loading…
Reference in New Issue
Block a user