Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dlp/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

[1]: https://pypi.org/project/google-cloud-dlp/#history

## 0.4.0

### Implementation Changes

- Remove DLP client version V2Beta1 (#5155)

## 0.3.0

### Implementation changes
Expand Down
2 changes: 1 addition & 1 deletion dlp/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

name = 'google-cloud-dlp'
description = 'Google Cloud DLP API client library'
version = '0.3.0'
version = '0.4.0'
# Should be one of:
# 'Development Status :: 3 - Alpha'
# 'Development Status :: 4 - Beta'
Expand Down
28 changes: 21 additions & 7 deletions dlp/tests/system/gapic/v2/test_system_dlp_service_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import time
import json
import os

from google.cloud import dlp_v2
from google.cloud.dlp_v2 import enums
from google.cloud.dlp_v2.proto import dlp_pb2


class TestSystemDlpService(object):

def _get_project_id(self):
env_var_name = 'GOOGLE_APPLICATION_CREDENTIALS'
path = os.environ[env_var_name]
json_data=open(path).read()
data = json.loads(json_data)
return data['project_id']

def test_inspect_content(self):
# get project id from json file
project_id = self._get_project_id()

client = dlp_v2.DlpServiceClient()
min_likelihood = enums.Likelihood.POSSIBLE
inspect_config = {'min_likelihood': min_likelihood}
type_ = 'text/plain'
value = 'my phone number is 215-512-1212'
items_element = {'type': type_, 'value': value}
items = [items_element]
response = client.inspect_content(inspect_config, items)
info_types = [{'name': 'FIRST_NAME'}, {'name': 'LAST_NAME'}]
inspect_config = {
'info_types': info_types,
'min_likelihood': min_likelihood,
}
item = {'value': 'Robert Frost'}
parent = client.project_path(project_id)
response = client.inspect_content(parent, inspect_config, item)