@mock.patch("glance_store._drivers.swift.store.ks_v3")
    @mock.patch("glance_store._drivers.swift.store.ks_session")
    @mock.patch("glance_store._drivers.swift.store.ks_client")
    def test_init_client_single_tenant(self,
                                       mock_client, mock_session, mock_v3):
        """Test that keystone client was initialized correctly"""
        # initialize client
        store = Store(self.conf)
        store.configure()
        uri = "swift://%s:key@auth_address/glance/%s" % (
            self.swift_store_user, FAKE_UUID)
        loc = location.get_location_from_uri(uri, conf=self.conf)
        ctxt = mock.MagicMock()
        store.init_client(location=loc.store_location, context=ctxt)
        # check that keystone was initialized correctly
        tenant = None if store.auth_version == '1' else "tenant"
        username = "tenant:user1" if store.auth_version == '1' else "user1"
        mock_v3.Password.assert_called_once_with(
            auth_url=loc.store_location.swift_url + '/',
            username=username, password="key",
            project_name=tenant,
            project_domain_id='default', project_domain_name=None,
            user_domain_id='default', user_domain_name=None,)
        mock_session.Session.assert_called_once_with(auth=mock_v3.Password())
        mock_client.Client.assert_called_once_with(
            session=mock_session.Session())
dataset/ETHPy150Open openstack/glance_store/glance_store/tests/unit/test_swift_store.py/TestStoreAuthV3.test_init_client_single_tenant/original