Ejemplo n.º 1
0
class CpfTest(TestCase):
    def setUp(self):
        self.cpf_with_formatting = CPF('010.787.400-89')
        self.cpf_without_formatting = CPF('01078740089')

    def test_cpf_with_formatting_validate_suze_return_true(self):
        self.assertTrue(self.cpf_with_formatting.validate_size())

    def test_cpf_without_formatting_validate_suze_return_true(self):
        self.assertTrue(self.cpf_without_formatting.validate_size())

    def test_cpf_validate_size_return_false(self):
        cpf = CPF('1234567891')
        self.assertFalse(cpf.validate_size())

    def test_cpf_format_return_true(self):
        self.assertEqual(self.cpf_without_formatting.format(),
                         '010.787.400-89')

    def test_cpf_format_return_false(self):
        self.assertNotEqual(self.cpf_without_formatting.format(),
                            '01078740089')

    def test_cpf_cleaning_return_true(self):
        self.assertEqual(self.cpf_with_formatting.cleaning(), '01078740089')

    def test_cpf_cleaning_return_false(self):
        self.assertNotEqual(self.cpf_with_formatting.cleaning(),
                            '010787400-89')

    def test_cpf_with_formatting_validate_return_true(self):
        self.assertTrue(self.cpf_with_formatting.validate())

    def test_cpf_with_formatting_validate_return_false(self):
        cpf = CPF('010.787.400-8')
        self.assertFalse(cpf.validate())

    def test_cpf_without_formatting_validate_return_false(self):
        cpf = CPF('0107874008')
        self.assertFalse(cpf.validate())

    def test_cpf_without_formatting_validate_return_true(self):
        self.assertTrue(self.cpf_without_formatting.validate())
Ejemplo n.º 2
0
class CpfTest(TestCase):

    def setUp(self):
        self.cpf_with_formatting = CPF('010.787.400-89')
        self.cpf_without_formatting = CPF('01078740089')

    def test_cpf_with_formatting_validate_suze_return_true(self):
        self.assertTrue(self.cpf_with_formatting.validate_size())

    def test_cpf_without_formatting_validate_suze_return_true(self):
        self.assertTrue(self.cpf_without_formatting.validate_size())

    def test_cpf_validate_size_return_false(self):
        cpf = CPF('1234567891')
        self.assertFalse(cpf.validate_size())

    def test_cpf_format_return_true(self):
        self.assertEqual(self.cpf_without_formatting.format(), '010.787.400-89')

    def test_cpf_format_return_false(self):
        self.assertNotEqual(self.cpf_without_formatting.format(), '01078740089')

    def test_cpf_cleaning_return_true(self):
        self.assertEqual(self.cpf_with_formatting.cleaning(), '01078740089')

    def test_cpf_cleaning_return_false(self):
        self.assertNotEqual(self.cpf_with_formatting.cleaning(),
            '010787400-89')

    def test_cpf_with_formatting_validate_return_true(self):
        self.assertTrue(self.cpf_with_formatting.validate())

    def test_cpf_with_formatting_validate_return_false(self):
        cpf = CPF('010.787.400-8')
        self.assertFalse(cpf.validate())

    def test_cpf_without_formatting_validate_return_false(self):
        cpf = CPF('0107874008')
        self.assertFalse(cpf.validate())

    def test_cpf_without_formatting_validate_return_true(self):
        self.assertTrue(self.cpf_without_formatting.validate())
Ejemplo n.º 3
0
 def test_cpf_without_formatting_validate_return_false(self):
     cpf = CPF('0107874008')
     self.assertFalse(cpf.validate())
Ejemplo n.º 4
0
 def test_cpf_with_formatting_validate_return_false(self):
     cpf = CPF('010.787.400-8')
     self.assertFalse(cpf.validate())
Ejemplo n.º 5
0
 def test_cpf_validate_size_return_false(self):
     cpf = CPF('1234567891')
     self.assertFalse(cpf.validate_size())
Ejemplo n.º 6
0
 def setUp(self):
     self.cpf_with_formatting = CPF('010.787.400-89')
     self.cpf_without_formatting = CPF('01078740089')
Ejemplo n.º 7
0
 def test_cpf_without_formatting_validate_return_false(self):
     cpf = CPF('0107874008')
     self.assertFalse(cpf.validate())
Ejemplo n.º 8
0
 def test_cpf_with_formatting_validate_return_false(self):
     cpf = CPF('010.787.400-8')
     self.assertFalse(cpf.validate())
Ejemplo n.º 9
0
 def test_cpf_validate_size_return_false(self):
     cpf = CPF('1234567891')
     self.assertFalse(cpf.validate_size())
Ejemplo n.º 10
0
 def setUp(self):
     self.cpf_with_formatting = CPF('010.787.400-89')
     self.cpf_without_formatting = CPF('01078740089')
Ejemplo n.º 11
0
 def format_cpf(self):
     return CPF(self.cpf).format()