# Path: bambou/utils/sha1.py
# class Sha1(object):
#     """ Encrypt Sha1 """
# 
#     @classmethod
#     def encrypt(self, message):
#         """ Encrypt the given message """
# 
#         if not isinstance(message, (bytes, str)):
#             raise TypeError
#         
#         return hashlib.sha1(message.encode('utf-8')).hexdigest()


from unittest import TestCase
from bambou.utils import Sha1
# -*- coding:utf-8 -*-



class Sha1Tests(TestCase):

    @classmethod
    def setUpClass(self):
        """ Initialize context """
        pass

    @classmethod
    def tearDownClass(self):
        """ Removes context """
        pass

    def test_encrypt_with_message(self):
        """ Sha1 encryption with a message """

        message ="HelloWorld"
        encrypted = Sha1.encrypt(message)

        self.assertEquals(encrypted, 'db8ac1c259eb89d4a131b253bacfca5f319d54f2')

    def test_encrypt_without_message(self):
        """ Sha1 encryption without a message """

        with self.assertRaises(TypeError):

# Path: bambou/utils/sha1.py
# class Sha1(object):
#     """ Encrypt Sha1 """
# 
#     @classmethod
#     def encrypt(self, message):
#         """ Encrypt the given message """
# 
#         if not isinstance(message, (bytes, str)):
#             raise TypeError
#         
#         return hashlib.sha1(message.encode('utf-8')).hexdigest()


# Path: tests/unit/test_sha1.py
from unittest import TestCase
from bambou.utils import Sha1

# -*- coding:utf-8 -*-



class Sha1Tests(TestCase):

    @classmethod
    def setUpClass(self):
        """ Initialize context """
        pass

    @classmethod
    def tearDownClass(self):
        """ Removes context """
        pass

    def test_encrypt_with_message(self):
        """ Sha1 encryption with a message """

        message ="HelloWorld"
        encrypted = Sha1.encrypt(message)

        self.assertEquals(encrypted, 'db8ac1c259eb89d4a131b253bacfca5f319d54f2')

    def test_encrypt_without_message(self):
        """ Sha1 encryption without a message """

        with self.assertRaises(TypeError):

            Sha1.encrypt(None)