# Path: honeybadger/utils.py
# def filter_dict(data, filter_keys):
#     # filter_keys = set(data.keys())
#     if type(data) != dict:
#       return data
# 
#     for key, value in data.items():
#       if key in filter_keys:
#         data[key] = "[FILTERED]"
# 
#       if type(value) == dict:
#         data[key] = filter_dict(data[key], filter_keys)
# 
#     return data


from honeybadger.utils import filter_dict

def test_filter_dict():
    data = {'foo': 'bar', 'bar': 'baz'}
    expected = {'foo': '[FILTERED]', 'bar': 'baz'}
    filter_keys = ['foo']
    assert filter_dict(data, filter_keys) == expected

def test_filter_dict_with_nested_dict():
  data = {'foo': 'bar', 'bar': 'baz', 'nested': { 'password': 'helloworld' } }
  expected = {'foo': 'bar', 'bar': 'baz', 'nested': { 'password': '[FILTERED]' } }
  filter_keys = ['password']

# Path: honeybadger/utils.py
# def filter_dict(data, filter_keys):
#     # filter_keys = set(data.keys())
#     if type(data) != dict:
#       return data
# 
#     for key, value in data.items():
#       if key in filter_keys:
#         data[key] = "[FILTERED]"
# 
#       if type(value) == dict:
#         data[key] = filter_dict(data[key], filter_keys)
# 
#     return data


# Path: honeybadger/tests/test_utils.py
from honeybadger.utils import filter_dict


def test_filter_dict():
    data = {'foo': 'bar', 'bar': 'baz'}
    expected = {'foo': '[FILTERED]', 'bar': 'baz'}
    filter_keys = ['foo']
    assert filter_dict(data, filter_keys) == expected

def test_filter_dict_with_nested_dict():
  data = {'foo': 'bar', 'bar': 'baz', 'nested': { 'password': 'helloworld' } }
  expected = {'foo': 'bar', 'bar': 'baz', 'nested': { 'password': '[FILTERED]' } }
  filter_keys = ['password']

  assert filter_dict(data, filter_keys) == expected