Example #1
0
 def test_get_info_with_error_response(self):
     expected = {
         'success': False,
         'errors': ['some error'],
         'data': None,
     }
     self.mock_response.ok = False
     self.mock_response.text = 'some error'
     data = get_info()
     self.assertEqual(data, expected)
Example #2
0
 def test_get_info_with_error_response(self):
     expected = {
         'success': False,
         'errors': ['some error'],
         'data': None,
     }
     self.mock_response.ok = False
     self.mock_response.text = 'some error'
     data = get_info()
     self.assertEqual(data, expected)
Example #3
0
 def test_get_info(self):
     expected = {
         'success': True,
         'errors': [],
         'data': {'version': 1},
     }
     self.mock_response.ok = True
     self.mock_response.json.return_value = {'version': 1}
     data = get_info()
     self.assertEqual(data, expected)
Example #4
0
 def test_get_info(self):
     expected = {
         'success': True,
         'errors': [],
         'data': {
             'version': 1
         },
     }
     self.mock_response.ok = True
     self.mock_response.json.return_value = {'version': 1}
     data = get_info()
     self.assertEqual(data, expected)
Example #5
0
 def test_get_info_uses_environment_variables(self):
     with patch('snapcraft.storeapi.common.os.environ',
                {'UBUNTU_STORE_API_ROOT_URL': 'http://example.com'}):
         get_info()
     self.mock_get.assert_called_once_with('http://example.com')
Example #6
0
 def test_get_info_uses_environment_variables(self):
     with patch('snapcraft.storeapi.common.os.environ',
                {'UBUNTU_STORE_API_ROOT_URL': 'http://example.com'}):
         get_info()
     self.mock_get.assert_called_once_with('http://example.com')
 def test_get_info_with_error_response(self):
     expected = {"success": False, "errors": ["some error"], "data": None}
     self.mock_response.ok = False
     self.mock_response.text = "some error"
     data = get_info()
     self.assertEqual(data, expected)
 def test_get_info(self):
     expected = {"success": True, "errors": [], "data": {"version": 1}}
     self.mock_response.ok = True
     self.mock_response.json.return_value = {"version": 1}
     data = get_info()
     self.assertEqual(data, expected)