コード例 #1
0
ファイル: test_clients.py プロジェクト: wxy8961230/heat
    def test_clients_heat_no_auth_token(self, mock_call):
        con = mock.Mock()
        con.auth_url = "http://auth.example.com:5000/v2.0"
        con.tenant_id = "b363706f891f48019483f8bd6503c54b"
        con.auth_token = None
        con.auth_plugin = fakes.FakeAuth(auth_token='anewtoken')
        c = clients.Clients(con)
        con.clients = c

        obj = c.client_plugin('heat')
        obj.url_for = mock.Mock(name="url_for")
        obj.url_for.return_value = "url_from_keystone"
        self.assertEqual('url_from_keystone', obj.get_heat_url())
コード例 #2
0
ファイル: common.py プロジェクト: zzjeric/heat
 def stub_auth(self, ctx=None, **kwargs):
     auth = self.patchobject(ctx or context.RequestContext,
                             "_create_auth_plugin")
     fake_auth = fakes.FakeAuth(**kwargs)
     auth.return_value = fake_auth
     return auth