def get(self, cpf): if not validations.isValidCpf(cpf): return { 'code': '1001', "message": 'Invalid CPF' }, status.HTTP_412_PRECONDITION_FAILED user = db.getUserInfo(cpf) return json.dumps(user.__dict__)
def test_validCpf(self): self.assertTrue(validations.isValidCpf("22544050047"))
def test_invalidCpf(self): self.assertFalse(validations.isValidCpf("12345"))