def test_good_init(self): """Test the various valid ways to create a GPServiceAccount instance """ # used to distinguish values for different GPServiceAccount init calls USER_KEY = 'userEnvVar' VCAP_KEY = 'vcap' common.set_user_env_vars(suffix=USER_KEY) common.set_vcap_env_vars(suffix=VCAP_KEY) # test init method with params acc = common.get_gpserviceaccount() common.my_assert_equal(self, common.url, acc.get_url(), 'incorrect url from method params') common.my_assert_equal(self, common.instanceId, acc.get_instance_id(), 'incorrect instanceId from method params') common.my_assert_equal(self, common.userId, acc.get_user_id(), 'incorrect userId from method params') common.my_assert_equal(self, common.password, acc.get_password(), 'incorrect password from method params') # test init method with user defined env vars acc = GPServiceAccount() common.my_assert_equal(self, common.url + USER_KEY, acc.get_url(), 'incorrect url from user defined env vars') common.my_assert_equal(self, common.instanceId + USER_KEY, acc.get_instance_id(), 'incorrect instanceId from user defined env vars') common.my_assert_equal(self, common.userId + USER_KEY, acc.get_user_id(), 'incorrect userId from user defined env vars') common.my_assert_equal(self, common.password + USER_KEY, acc.get_password(), 'incorrect password from user defined env vars') # test init method with vcap env var common.unset_user_env_vars() acc = None acc = GPServiceAccount() common.my_assert_equal(self, common.url + VCAP_KEY, acc.get_url(), 'incorrect url from vcap env var') common.my_assert_equal(self, common.instanceId + VCAP_KEY, acc.get_instance_id(), 'incorrect instanceId from vcap env var') common.my_assert_equal(self, common.userId + VCAP_KEY, acc.get_user_id(), 'incorrect userId from vcap env var') common.my_assert_equal(self, common.password + VCAP_KEY, acc.get_password(), 'incorrect password from vcap env var')
def test_good_init(self): """Test the various valid ways to create a GPServiceAccount instance """ # used to distinguish values for different GPServiceAccount init calls USER_KEY = 'userEnvVar' VCAP_KEY = 'vcap' common.set_user_env_vars(suffix=USER_KEY) common.set_vcap_env_vars(suffix=VCAP_KEY) # test init method with params acc = common.get_gpserviceaccount() common.my_assert_equal(self, common.url, acc.get_url(), 'incorrect url from method params') common.my_assert_equal(self, common.instanceId, acc.get_instance_id(), 'incorrect instanceId from method params') common.my_assert_equal(self, common.userId, acc.get_user_id(), 'incorrect userId from method params') common.my_assert_equal(self, common.password, acc.get_password(), 'incorrect password from method params') # test init method with user defined env vars acc = GPServiceAccount() common.my_assert_equal(self, common.url + USER_KEY, acc.get_url(), 'incorrect url from user defined env vars') common.my_assert_equal( self, common.instanceId + USER_KEY, acc.get_instance_id(), 'incorrect instanceId from user defined env vars') common.my_assert_equal(self, common.userId + USER_KEY, acc.get_user_id(), 'incorrect userId from user defined env vars') common.my_assert_equal( self, common.password + USER_KEY, acc.get_password(), 'incorrect password from user defined env vars') # test init method with vcap env var common.unset_user_env_vars() acc = GPServiceAccount(serviceInstanceName=common.gpInstanceName) common.my_assert_equal(self, common.url + VCAP_KEY, acc.get_url(), 'incorrect url from vcap env var') common.my_assert_equal(self, common.instanceId + VCAP_KEY, acc.get_instance_id(), 'incorrect instanceId from vcap env var') common.my_assert_equal(self, common.userId + VCAP_KEY, acc.get_user_id(), 'incorrect userId from vcap env var') common.my_assert_equal(self, common.password + VCAP_KEY, acc.get_password(), 'incorrect password from vcap env var')
def tearDown(self): common.unset_user_env_vars() common.unset_vcap_env_vars()