install successfully using py3
This commit is contained in:
parent
cf2dda4532
commit
8346e89e99
41 changed files with 259 additions and 287 deletions
|
@ -5,16 +5,16 @@ class TestApcUrl(unittest.TestCase):
|
|||
def test_init(self):
|
||||
url = "/testing"
|
||||
u = ApcUrl(url)
|
||||
self.assertEquals( u.base_url, url)
|
||||
self.assertEqual( u.base_url, url)
|
||||
|
||||
def test_params_1(self):
|
||||
u = ApcUrl("/testing/%%key%%")
|
||||
self.assertEquals(u.params(key='val').url(), '/testing/val')
|
||||
self.assertEqual(u.params(key='val').url(), '/testing/val')
|
||||
|
||||
def test_params_2(self):
|
||||
u = ApcUrl('/testing/%%key%%/%%api%%/more_testing')
|
||||
full_url = u.params(key="AAA",api="BBB").url()
|
||||
self.assertEquals(full_url, '/testing/AAA/BBB/more_testing')
|
||||
self.assertEqual(full_url, '/testing/AAA/BBB/more_testing')
|
||||
|
||||
def test_params_ex(self):
|
||||
u = ApcUrl("/testing/%%key%%")
|
||||
|
@ -23,7 +23,7 @@ class TestApcUrl(unittest.TestCase):
|
|||
|
||||
def test_url(self):
|
||||
u = "one/two/three"
|
||||
self.assertEquals( ApcUrl(u).url(), u )
|
||||
self.assertEqual( ApcUrl(u).url(), u )
|
||||
|
||||
def test_url_ex(self):
|
||||
u = ApcUrl('/%%one%%/%%two%%/three').params(two='testing')
|
||||
|
|
|
@ -6,16 +6,16 @@ from .. api_client import ApcUrl, ApiRequest
|
|||
class TestApiRequest(unittest.TestCase):
|
||||
def test_init(self):
|
||||
u = ApiRequest('request_name', ApcUrl('/test/ing'))
|
||||
self.assertEquals(u.name, "request_name")
|
||||
self.assertEqual(u.name, "request_name")
|
||||
|
||||
def test_call(self):
|
||||
ret = json.dumps( {u'ok':u'ok'} )
|
||||
ret = json.dumps( {'ok':'ok'} )
|
||||
read = MagicMock()
|
||||
read.read = MagicMock(return_value=ret)
|
||||
u = '/testing'
|
||||
with patch('urllib2.urlopen') as mock_method:
|
||||
mock_method.return_value = read
|
||||
request = ApiRequest('mm', ApcUrl(u))()
|
||||
self.assertEquals(request, json.loads(ret))
|
||||
self.assertEqual(request, json.loads(ret))
|
||||
|
||||
if __name__ == '__main__': unittest.main()
|
||||
|
|
|
@ -19,7 +19,7 @@ class TestRequestProvider(unittest.TestCase):
|
|||
self.assertTrue( meth in rp )
|
||||
|
||||
def test_notify_webstream_data(self):
|
||||
ret = json.dumps( {u'testing' : u'123' } )
|
||||
ret = json.dumps( {'testing' : '123' } )
|
||||
rp = RequestProvider(self.cfg)
|
||||
read = MagicMock()
|
||||
read.read = MagicMock(return_value=ret)
|
||||
|
@ -27,6 +27,6 @@ class TestRequestProvider(unittest.TestCase):
|
|||
mock_method.return_value = read
|
||||
response = rp.notify_webstream_data(media_id=123)
|
||||
mock_method.called_once_with(media_id=123)
|
||||
self.assertEquals(json.loads(ret), response)
|
||||
self.assertEqual(json.loads(ret), response)
|
||||
|
||||
if __name__ == '__main__': unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue