'Test upload with registry if trust was not successfully created'

@mock.patch('glance.common.trust_auth.TokenRefresher')
def test_upload_with_trusts_fails(self, mock_refresher):

    self.config(data_api='glance.db.registry.api')
    mock_refresher().side_effect = Exception()
    request = unit_test_utils.get_fake_request()
    image = FakeImage('abcd')
    self.image_repo.result = image
    self.controller.upload(request, unit_test_utils.UUID2, 'YYYY', 4)
    self.assertEqual('YYYY', image.data)
    self.assertEqual(4, image.size)
    self.assertEqual(0, mock_refresher().refresh_token.call_count)
