test_session.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # Copyright (c) 2012-2013 LiuYC https://github.com/liuyichen/
  2. # Copyright 2012-2014 ksyun.com, Inc. or its affiliates. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License"). You
  5. # may not use this file except in compliance with the License. A copy of
  6. # the License is located at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # or in the "license" file accompanying this file. This file is
  11. # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  12. # ANY KIND, either express or implied. See the License for the specific
  13. # language governing permissions and limitations under the License.
  14. from tests import unittest
  15. import kscore.session
  16. class TestCanChangeParsing(unittest.TestCase):
  17. def setUp(self):
  18. self.session = kscore.session.get_session()
  19. def test_maps_service_name_when_overriden(self):
  20. gametest = self.session.get_service_model('kog')
  21. self.assertEqual(gametest.endpoint_prefix, 'kog')
  22. # But we should map the service_name to be the same name
  23. # used when calling get_service_model which is different
  24. # than the endpoint_prefix.
  25. self.assertEqual(gametest.service_name, 'kog')
  26. def test_maps_service_name_from_client(self):
  27. # Same thing as test_maps_service_name_from_client,
  28. # except through the client interface.
  29. client = self.session.create_client('kog', region_name='cn-beijing-6')
  30. self.assertEqual(client.meta.service_model.service_name, 'kog')