# Path: barbicanclient/base.py
# LOG = logging.getLogger(__name__)
# def filter_null_keys(dictionary):
# def censored_copy(data_dict, censor_keys):
# def validate_ref_and_return_uuid(ref, entity):
# def calculate_uuid_ref(ref, entity):
#     def __init__(self, attribute=None):
#     def __init__(self, api, entity):
#     def total(self):
# class ImmutableException(Exception):
# class BaseEntityManager(object):
# 
# Path: barbicanclient/version.py



import testtools
import uuid
import barbicanclient
from barbicanclient import base
from barbicanclient import version
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.




class TestValidateRef(testtools.TestCase):

    def test_valid_ref(self):
        secret_uuid = uuid.uuid4()
        ref = 'http://localhost/' + str(secret_uuid)
        self.assertEqual(secret_uuid,
                         base.validate_ref_and_return_uuid(ref, 'Thing'))

    def test_valid_uuid(self):
        secret_uuid = uuid.uuid4()
        self.assertEqual(secret_uuid,
                         base.validate_ref_and_return_uuid(str(secret_uuid),
                                                           'Thing'))

    def test_invalid_uuid(self):
        ref = 'http://localhost/not_a_uuid'
        self.assertRaises(ValueError, base.validate_ref_and_return_uuid, ref,
                          'Thing')

    def test_censored_copy(self):
        d1 = {'a': '1', 'password': 'my_password', 'payload': 'my_key',
              'b': '2'}

# Path: barbicanclient/base.py
# LOG = logging.getLogger(__name__)
# def filter_null_keys(dictionary):
# def censored_copy(data_dict, censor_keys):
# def validate_ref_and_return_uuid(ref, entity):
# def calculate_uuid_ref(ref, entity):
#     def __init__(self, attribute=None):
#     def __init__(self, api, entity):
#     def total(self):
# class ImmutableException(Exception):
# class BaseEntityManager(object):
# 
# Path: barbicanclient/version.py



# Path: barbicanclient/tests/test_base.py
import testtools
import uuid
import barbicanclient
from barbicanclient import base
from barbicanclient import version

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.




class TestValidateRef(testtools.TestCase):

    def test_valid_ref(self):
        secret_uuid = uuid.uuid4()
        ref = 'http://localhost/' + str(secret_uuid)
        self.assertEqual(secret_uuid,
                         base.validate_ref_and_return_uuid(ref, 'Thing'))

    def test_valid_uuid(self):
        secret_uuid = uuid.uuid4()
        self.assertEqual(secret_uuid,
                         base.validate_ref_and_return_uuid(str(secret_uuid),
                                                           'Thing'))

    def test_invalid_uuid(self):
        ref = 'http://localhost/not_a_uuid'
        self.assertRaises(ValueError, base.validate_ref_and_return_uuid, ref,
                          'Thing')

    def test_censored_copy(self):
        d1 = {'a': '1', 'password': 'my_password', 'payload': 'my_key',
              'b': '2'}

        d2 = base.censored_copy(d1, None)