def test_json(self):
     WebApi.get = Mock()
     WebApi.json('interface', 'method', 2, test='param')
     WebApi.get.assert_called_once_with('json',
                                        'interface',
                                        'method',
                                        2,
                                        test='param')
 def test_get(self):
     urllib2.urlopen = Mock(return_value=__builtin__)
     urllib.urlencode = Mock(return_value='urlencode')
     __builtin__.read = Mock(return_value='data')
     assert_equal(
         'data', WebApi.get('json', 'interface', 'method', 2, test='param'))
     urllib2.urlopen.assert_called_once_with(
         'http://api.steampowered.com/interface/method/v0002/', 'urlencode')
     urllib.urlencode.assert_called_once_with({
         'format': 'json',
         'key': '0123456789ABCDEF0123456789ABCDEF',
         'test': 'param'
     })
 def test_get(self):
     urllib2.urlopen = Mock(return_value=__builtin__)
     urllib.urlencode = Mock(return_value='urlencode')
     __builtin__.read = Mock(return_value='data')
     assert_equal('data', WebApi.get('json', 'interface', 'method', 2,
                  test='param'))
     urllib2.urlopen.assert_called_once_with(
         'http://api.steampowered.com/interface/method/v0002/',
         'urlencode')
     urllib.urlencode.assert_called_once_with(
         {'format': 'json', 'key': '0123456789ABCDEF0123456789ABCDEF',
          'test': 'param'}
     )
 def test_get_error(self):
     urllib2.urlopen = Mock(
         side_effect=urllib2.HTTPError('', 404, 'not found', None, None))
     WebApi.get('json', 'interface', 'method', 2, test='param')
 def test_get_error(self):
     urllib2.urlopen = Mock(side_effect=urllib2.HTTPError('', 404,
                                                          'not found',
                                                          None, None))
     WebApi.get('json', 'interface', 'method', 2, test='param')
 def test_json(self):
     WebApi.get = Mock()
     WebApi.json('interface', 'method', 2, test='param')
     WebApi.get.assert_called_once_with('json', 'interface', 'method', 2,
                                        test='param')