def test_read(self, mock_creds, mock_epic_api): """Test that read CLI command invokes retrieveHandle API method when no key param is supplied. """ self.args.handle = '90210//TEST_CR1' self.args.key = None epicclient.read(self.args) mock_creds.assert_called_once mock_creds.assert_called_once_with(self.creds['store'], self.credpath) mock_creds.parse.assert_called_once mock_creds_instance = mock_creds.return_value mock_epic_api.assert_called_once mock_epic_api.assert_called_once_with(mock_creds_instance) mock_epic_api_instance = mock_epic_api.return_value mock_epic_api_instance.retrieveHandle.assert_called_once mock_epic_api_instance.retrieveHandle.assert_called_once_with( self.args.handle.partition("/")[0], self.args.handle.partition("/")[2])
def test_read_with_key(self, mock_creds, mock_epic_api): """Test that read CLI command invokes getValueFromHandle API method when a key is supplied. """ self.args.handle = '90210//TEST_CR1' self.args.key = 'FOO_KEY' epicclient.read(self.args) mock_creds.assert_called_once mock_creds.assert_called_once_with(self.creds['store'], self.credpath) mock_creds.parse.assert_called_once mock_creds_instance = mock_creds.return_value mock_epic_api.assert_called_once mock_epic_api.assert_called_once_with(mock_creds_instance) mock_epic_api_instance = mock_epic_api.return_value mock_epic_api_instance.getValueFromHandle.assert_called_once mock_epic_api_instance.getValueFromHandle.assert_called_once_with( '90210//TEST_CR1'.partition("/")[0], 'FOO_KEY', '90210//TEST_CR1'.partition("/")[2])