Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 7
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)
Ejemplo n.º 8
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)