Skip to content

Commit

Permalink
Few more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
sharat87 committed Mar 20, 2019
1 parent b9be4f1 commit 36878a8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions python3/test_roast.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
"""
Tests for the roast.vim plugin's core implementation.
Tests written in this module should be able to run WITHOUT the vim module.
"""

import roast_api as ra


def test_rest_methods_request():
assert ra.build_request(['PUT https://httpbin.org/put'], 0).method == 'PUT'
assert ra.build_request(['PATCH https://httpbin.org/PATCH'], 0).method == 'PATCH'
assert ra.build_request(['DELETE https://httpbin.org/DELETE'], 0).method == 'DELETE'


def test_host_header():
req = ra.build_request([
'Host: https://httpbin.org',
Expand Down Expand Up @@ -69,3 +81,13 @@ def test_interpolation_with_other_params():
], 0)

assert req.params == {'name': 'stark', 'answer': 'ans_by_stark'}


def test_interpolation_in_headers():
req = ra.build_request([
'set fmt javascript',
'Accept: application/{fmt}',
'GET /get',
], 2)

assert req.headers['accept'] == 'application/javascript'

0 comments on commit 36878a8

Please sign in to comment.