mirror of
https://github.com/httpie/cli.git
synced 2024-11-24 08:22:22 +02:00
Replaced mock.Mock
with argparse.Namespace
to reduce deps.
This commit is contained in:
parent
0e1affbbc4
commit
5a47f00bac
@ -1,9 +1,10 @@
|
||||
import unittest
|
||||
from argparse import Namespace
|
||||
from httpie.cliparse import HTTPieArgumentParser, KeyValue
|
||||
from mock import Mock
|
||||
|
||||
|
||||
__author__ = 'vladimir'
|
||||
|
||||
import unittest
|
||||
|
||||
|
||||
class HTTPieArgumentParserTestCase(unittest.TestCase):
|
||||
@ -13,7 +14,7 @@ class HTTPieArgumentParserTestCase(unittest.TestCase):
|
||||
self.httpie_argument_parser = self.HTTPieArgumentParserStub()
|
||||
|
||||
def test_suggest_when_method_set_and_valid(self):
|
||||
args = Mock()
|
||||
args = Namespace()
|
||||
args.method = 'GET'
|
||||
args.url = 'http://example.com/'
|
||||
args.items = []
|
||||
@ -25,7 +26,7 @@ class HTTPieArgumentParserTestCase(unittest.TestCase):
|
||||
self.assertEquals(args.items, [])
|
||||
|
||||
def test_suggest_when_method_not_set(self):
|
||||
args = Mock()
|
||||
args = Namespace()
|
||||
args.method = None
|
||||
args.url = 'http://example.com/'
|
||||
args.items = []
|
||||
@ -37,7 +38,7 @@ class HTTPieArgumentParserTestCase(unittest.TestCase):
|
||||
self.assertEquals(args.items, [])
|
||||
|
||||
def test_suggest_when_method_set_but_invalid_and_data_field(self):
|
||||
args = Mock()
|
||||
args = Namespace()
|
||||
args.method = 'http://example.com/'
|
||||
args.url = 'data=field'
|
||||
args.items = []
|
||||
@ -49,7 +50,7 @@ class HTTPieArgumentParserTestCase(unittest.TestCase):
|
||||
self.assertEquals(args.items, [KeyValue(key='data', value='field', sep='=', orig='data=field')])
|
||||
|
||||
def test_suggest_when_method_set_but_invalid_and_header_field(self):
|
||||
args = Mock()
|
||||
args = Namespace()
|
||||
args.method = 'http://example.com/'
|
||||
args.url = 'test:header'
|
||||
args.items = []
|
||||
@ -61,7 +62,7 @@ class HTTPieArgumentParserTestCase(unittest.TestCase):
|
||||
self.assertEquals(args.items, [KeyValue(key='test', value='header', sep=':', orig='test:header')])
|
||||
|
||||
def test_suggest_when_method_set_but_invalid_and_item_exists(self):
|
||||
args = Mock()
|
||||
args = Namespace()
|
||||
args.method = 'http://example.com/'
|
||||
args.url = 'new_item=a'
|
||||
args.items = [KeyValue(key='old_item', value='b', sep='=', orig='old_item=b')]
|
||||
|
Loading…
Reference in New Issue
Block a user