# Copyright (c) 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest

from swift.common.swob import Request

from swift3.test.unit import Swift3TestCase
from swift3.etree import fromstring


class TestSwift3Location(Swift3TestCase):

    def setUp(self):
        super(TestSwift3Location, self).setUp()

    def test_object_location(self):
        req = Request.blank('/bucket/object?location',
                            environ={'REQUEST_METHOD': 'GET'},
                            headers={'Authorization': 'AWS test:tester:hmac'})
        status, headers, body = self.call_swift3(req)
        self.assertEquals(status.split()[0], '200')
        fromstring(body, 'LocationConstraint')

if __name__ == '__main__':
    unittest.main()

@@ -719,16 +719,44 @@
 mstring%0A
+from swift3.cfg import CONF%0A
 %0A%0Aclass 
@@ -865,87 +865,751 @@
 p()%0A
-%0A    def test_object_location(self):%0A        req = Request.blank('/bucket/objec
+        # allow to change location config in test code%0A        self.orig_loc = CONF.location%0A%0A    def tearDown(self):%0A        CONF.location = self.orig_loc%0A%0A    def test_object_location(self):%0A        req = Request.blank('/bucket?location',%0A                            environ=%7B'REQUEST_METHOD': 'GET'%7D,%0A                            headers=%7B'Authorization': 'AWS test:tester:hmac'%7D)%0A        status, headers, body = self.call_swift3(req)%0A        self.assertEquals(status.split()%5B0%5D, '200')%0A        elem = fromstring(body, 'LocationConstraint')%0A        location = elem.text%0A        self.assertEquals(location, None)%0A%0A    def test_object_location_setting_as_us_west_1(self):%0A        CONF.location = 'us-west-1'%0A        req = Request.blank('/bucke
 t?lo
@@ -1872,16 +1872,23 @@
 %0A       
+ elem =
  fromstr
@@ -1919,16 +1919,95 @@
 raint')%0A
+        location = elem.text%0A        self.assertEquals(location, 'us-west-1')%0A%0A
 %0Aif __na

Fix test_location unit test