Updated framework unit tests
This commit is contained in:
parent
eb52952eaa
commit
89d710fe28
2 changed files with 10 additions and 10 deletions
|
@ -70,7 +70,7 @@ parameterMetaTests() {
|
||||||
test('injects header or throws', () async {
|
test('injects header or throws', () async {
|
||||||
// Invalid request
|
// Invalid request
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/header'));
|
var rq = MockHttpRequest('GET', Uri.parse('/header'));
|
||||||
rq.close();
|
await rq.close();
|
||||||
var rs = rq.response;
|
var rs = rq.response;
|
||||||
http.handleRequest(rq);
|
http.handleRequest(rq);
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ parameterMetaTests() {
|
||||||
// Valid request
|
// Valid request
|
||||||
rq = MockHttpRequest('GET', Uri.parse('/header'))
|
rq = MockHttpRequest('GET', Uri.parse('/header'))
|
||||||
..headers.add('x-foo', 'bar');
|
..headers.add('x-foo', 'bar');
|
||||||
rq.close();
|
await rq.close();
|
||||||
rs = rq.response;
|
rs = rq.response;
|
||||||
http.handleRequest(rq);
|
http.handleRequest(rq);
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ parameterMetaTests() {
|
||||||
test('injects session or throws', () async {
|
test('injects session or throws', () async {
|
||||||
// Invalid request
|
// Invalid request
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/session'));
|
var rq = MockHttpRequest('GET', Uri.parse('/session'));
|
||||||
rq.close();
|
await rq.close();
|
||||||
var rs = rq.response;
|
var rs = rq.response;
|
||||||
http
|
http
|
||||||
.handleRequest(rq)
|
.handleRequest(rq)
|
||||||
|
@ -105,7 +105,7 @@ parameterMetaTests() {
|
||||||
|
|
||||||
rq = MockHttpRequest('GET', Uri.parse('/session'));
|
rq = MockHttpRequest('GET', Uri.parse('/session'));
|
||||||
rq.session['foo'] = 'bar';
|
rq.session['foo'] = 'bar';
|
||||||
rq.close();
|
await rq.close();
|
||||||
rs = rq.response;
|
rs = rq.response;
|
||||||
http.handleRequest(rq);
|
http.handleRequest(rq);
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ parameterMetaTests() {
|
||||||
|
|
||||||
test('pattern matching', () async {
|
test('pattern matching', () async {
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/match?mode=pos'));
|
var rq = MockHttpRequest('GET', Uri.parse('/match?mode=pos'));
|
||||||
rq.close();
|
await rq.close();
|
||||||
var rs = rq.response;
|
var rs = rq.response;
|
||||||
http.handleRequest(rq);
|
http.handleRequest(rq);
|
||||||
var body = await readResponse(rs);
|
var body = await readResponse(rs);
|
||||||
|
@ -128,7 +128,7 @@ parameterMetaTests() {
|
||||||
expect(body, json.encode('YES pos'));
|
expect(body, json.encode('YES pos'));
|
||||||
|
|
||||||
rq = MockHttpRequest('GET', Uri.parse('/match?mode=neg'));
|
rq = MockHttpRequest('GET', Uri.parse('/match?mode=neg'));
|
||||||
rq.close();
|
await rq.close();
|
||||||
rs = rq.response;
|
rs = rq.response;
|
||||||
http.handleRequest(rq);
|
http.handleRequest(rq);
|
||||||
body = await readResponse(rs);
|
body = await readResponse(rs);
|
||||||
|
@ -138,7 +138,7 @@ parameterMetaTests() {
|
||||||
|
|
||||||
// Fallback
|
// Fallback
|
||||||
rq = MockHttpRequest('GET', Uri.parse('/match?mode=ambi'));
|
rq = MockHttpRequest('GET', Uri.parse('/match?mode=ambi'));
|
||||||
rq.close();
|
await rq.close();
|
||||||
rs = rq.response;
|
rs = rq.response;
|
||||||
http.handleRequest(rq);
|
http.handleRequest(rq);
|
||||||
body = await readResponse(rs);
|
body = await readResponse(rs);
|
||||||
|
|
|
@ -178,7 +178,7 @@ void main() {
|
||||||
test('can send json', () async {
|
test('can send json', () async {
|
||||||
var rq = MockHttpRequest('GET', Uri(path: 'wtf'))
|
var rq = MockHttpRequest('GET', Uri(path: 'wtf'))
|
||||||
..headers.set('accept', 'application/json');
|
..headers.set('accept', 'application/json');
|
||||||
rq.close();
|
await rq.close();
|
||||||
http.handleRequest(rq);
|
http.handleRequest(rq);
|
||||||
await rq.response.toList();
|
await rq.response.toList();
|
||||||
expect(rq.response.statusCode, 403);
|
expect(rq.response.statusCode, 403);
|
||||||
|
@ -188,7 +188,7 @@ void main() {
|
||||||
test('can throw in finalizer', () async {
|
test('can throw in finalizer', () async {
|
||||||
var rq = MockHttpRequest('GET', Uri(path: 'wtf'))
|
var rq = MockHttpRequest('GET', Uri(path: 'wtf'))
|
||||||
..headers.set('accept', 'application/json');
|
..headers.set('accept', 'application/json');
|
||||||
rq.close();
|
await rq.close();
|
||||||
http.handleRequest(rq);
|
http.handleRequest(rq);
|
||||||
await rq.response.toList();
|
await rq.response.toList();
|
||||||
expect(rq.response.statusCode, 403);
|
expect(rq.response.statusCode, 403);
|
||||||
|
@ -198,7 +198,7 @@ void main() {
|
||||||
test('can send html', () async {
|
test('can send html', () async {
|
||||||
var rq = MockHttpRequest('GET', Uri(path: 'wtf2'));
|
var rq = MockHttpRequest('GET', Uri(path: 'wtf2'));
|
||||||
//rq.headers.set('accept', 'text/html');
|
//rq.headers.set('accept', 'text/html');
|
||||||
rq.close();
|
await rq.close();
|
||||||
http.handleRequest(rq);
|
http.handleRequest(rq);
|
||||||
await rq.response.toList();
|
await rq.response.toList();
|
||||||
expect(rq.response.statusCode, 403);
|
expect(rq.response.statusCode, 403);
|
||||||
|
|
Loading…
Reference in a new issue