Patch default credentials when executing command unit tests.

Change-Id: I9cc69082ee3da64be83f53c5be12f656af606951
This commit is contained in:
Federico Ressi 2019-03-14 14:59:14 +01:00
parent 0117ddac81
commit 086ad8fc15
1 changed files with 15 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import os.path
from tobiko.cmd import base
from tobiko.tests.unit import TobikoUnitTest
from tobiko.openstack import keystone
class TobikoCMDTest(TobikoUnitTest):
@ -25,6 +26,20 @@ class TobikoCMDTest(TobikoUnitTest):
command_name = None
command_class = base.TobikoCMD
default_credentials = keystone.keystone_credentials(
api_version=3,
auth_url='http://127.0.0.1:5000/identiy/v3',
username='demo',
project_name='demo',
password='this is a secret',
user_domain_name='Default',
project_domain_name='Default')
def setUp(self):
TobikoUnitTest.setUp(self)
self.patch('tobiko.openstack.keystone.default_keystone_credentials',
return_value=self.default_credentials)
def test_init(self, argv=None):
self.patch_argv(argv=argv)
cmd = self.command_class()