예제 #1
0
def people_edit_benefits(idWho):
	""" It receives the person's id and checks if the user can edit that person's
	benefits. Then it proceeds in checking the list of benefits added and or excluded
	from the person's profile. If new data might be necessary (needs_data_check), it
	returns the people_register_data with a list of all combined data (new and current)
	for data input. Benefit_updated_data_types is only True when the benefit updates its
	list of data types and those data types don't match the person's data in the database,
	requiring new data inputs """
	idWho = validate_person_idwho(idWho, session['idCompany'])
	if idWho:
		if request.method == "POST":
			ids_benefits = str_list_to_int(request.form.getlist("idBenefit"))
			needs_data_check = update_person_benefits(idWho, ids_benefits)
			benefit_updated_data_types = request.form.get("force_update")
			if needs_data_check or benefit_updated_data_types:
				combined_data = get_combined_data_for_person(ids_benefits, idWho)
				return render_template("people_register_data.html", 
										combined_data = combined_data, 
										header = get_header(session),
										person_id = idWho)
			return redirect("/pessoas/perfil/{}".format(idWho))
		else: # 'GET'
			return render_template("people_edit_benefits.html", 
							header = get_header(session),
							profile = PersonProfile(idWho).get_profile(),
							benefits_list = CompanyProfile(session['idCompany']).get_benefits())
	else:
		whoops = "Este perfil não existe, por favor selecione uma pessoa da lista."
		people_list = CompanyProfile(session["idCompany"]).get_people()
		return render_template("people_list.html", header = get_header(session), 
									people_list = people_list, whoops = whoops)
class TestGetName(unittest.TestCase):
    def setUp(self):
        call("./setup/start_testing.sh")

        self.profile_one = CompanyProfile(1)
        self.profile_two = CompanyProfile(2)
        self.profile_three = CompanyProfile(3)

    def tearDown(self):
        call("./setup/finish_testing.sh")

    def test_get_company_name_one(self):
        actual_result = self.profile_one.get_name()
        expected_result = "Wonka Industries"
        self.assertEqual(actual_result, expected_result)

    def test_get_company_name_two(self):
        actual_result = self.profile_two.get_name()
        expected_result = "Tio Patinhas Bank"
        self.assertEqual(actual_result, expected_result)

    def test_get_company_name_three(self):
        actual_result = self.profile_three.get_name()
        expected_result = "Acme Co"
        self.assertEqual(actual_result, expected_result)

    def test_get_company_name_company_doesnt_exist(self):
        with self.assertRaises(Exception):
            CompanyProfile(9999).get_name()

    def test_get_company_name_string_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile("1").get_name()

    def test_get_company_name_float_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(1.3).get_name()

    def test_get_company_name_datatype_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(str).get_name()

    def test_get_company_name_none_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(None).get_name()

    def test_get_company_name_empy_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile().get_name()

    def test_get_company_name_boolean_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(True).get_name()
예제 #3
0
def benefits_data_types(idWho):
	""" Receives the benefit's id (idWho) and checks if the user is allowed to edit that
	benefits types of data. If 'GET' method, a list of all data types available and a list of the
	Benefit's pre selected types of data is returned. If 'POST' method, the information received 
	is checked and then updated to the database."""
	idWho = validate_benefit_idwho(idWho, session['idCompany'])
	if idWho:
		if request.method == "POST":
			ids_datatype = request.form.getlist("idDatatype")
			ids_datatype_check = data_types_exist(ids_datatype)
			if ids_datatype_check is not None:
				update_benefit_data_types(idWho, ids_datatype_check)
				return redirect("/beneficios/perfil/{}".format(idWho))
			else: 
				whoops = "Houve um erro na atualização dos tipos de dado. Selecione outro do menu."
				profile = BenefitProfile(idWho).get_profile()
				available_datatypes = get_available_data_types_for_benefit(idWho)
				return render_template("benefits_edit_data_types.html", 
										header = get_header(session), profile = profile, 
										available_datatypes = available_datatypes)
		else: # 'GET'
			profile = BenefitProfile(idWho).get_profile()
			available_datatypes = get_available_data_types_for_benefit(idWho)
			return render_template("benefits_edit_data_types.html", 
									header = get_header(session), profile = profile, 
									available_datatypes = available_datatypes)
	else:
		whoops = "Este perfil não existe, por favor selecione um benefício da lista."
		benefits_list = CompanyProfile(session["idCompany"]).get_benefits()
		return render_template("benefits_list.html", header = get_header(session), 
								benefits_list = benefits_list, whoops = whoops)
예제 #4
0
def benefits_register_new_data_type(idWho):
	""" Receives the benefit's id (idWho) and checks if the user is allowed to register a new 
 	type of data for that benefit. If 'GET' method, a list of all data types registered in
 	the database is returned. If 'POST' method, the new data type is checked before being
 	registered in the database and added to the list of data types of the benefit"""
	idWho = validate_benefit_idwho(idWho, session['idCompany'])
	if idWho:
		if request.method == "POST":
			name = request.form.get("name")
			example = request.form.get("example")
			if name and example:
				register_new_data_type(name, example, idWho)
				return redirect("/beneficios/perfil/{}".format(idWho))
			else:
				data_list = get_all_data_types()
				whoops = "Você precisa preencher os dois campos"
				return render_template("benefits_register_new_data_type.html", 
												header = get_header(session),
												data_list = data_list,
												idWho = idWho, whoops = whoops)
		else: # 'GET'
			data_list = get_all_data_types()
			return render_template("benefits_register_new_data_type.html", 
												header = get_header(session),
												data_list = data_list,
												idWho = idWho)
	else:
		whoops = "Este perfil não existe, por favor selecione um benefício da lista."
		benefits_list = CompanyProfile(session["idCompany"]).get_benefits()
		return render_template("benefits_list.html", header = get_header(session), 
								benefits_list = benefits_list, whoops = whoops)
예제 #5
0
def benefits_delete_profile():
	""" Receives (through form) the id of the benefit to be deleted. First the
	benefit id is checked and then deleted. Benefit is not truly deleted from database, 
	for it can still be used by other companies. Only the company's registration with
	that benefit is deleted """
	idBenefit = str_to_int(request.form.get("idBenefit"))
	if benefit_exists(idBenefit):
		delete_benefit_profile(idBenefit, session["idCompany"])
		return redirect("/beneficios/lista")
	else: 
		whoops = """Este perfil não existe, por favor selecione outro da lista."""
		benefits_list = CompanyProfile(session["idCompany"]).get_benefits()
		return render_template("benefits_list.html", header = get_header(session), 
								benefits_list = benefits_list, whoops = whoops)
예제 #6
0
def people_profile(idWho):
	""" Receives the person's id (idWho) and checks if the user is allowed to see
	that person's profile. This is an upgrade from the last version in which anyone could 
	see any person, even if the person wasn't part of the company. If that is the case an 
	alert is shown to the user. Otherwise the person's profile is returned."""
	idWho = validate_person_idwho(idWho, session['idCompany'])
	if idWho:
		profile = PersonProfile(idWho).get_profile()
		return render_template("people_profile.html", header = get_header(session),
													profile = profile)
	else:
		whoops = "Este perfil não existe, por favor selecione uma pessoa da lista."
		people_list = CompanyProfile(session["idCompany"]).get_people()
		return render_template("people_list.html", header = get_header(session), 
										people_list = people_list, whoops = whoops)
예제 #7
0
def people_delete_profile():
	""" Receives (through form) the id of the person to be deleted. First the
	person id is checked and then deleted. The person's row in the person table,
	and all other data connected to that person is also deleted. """
	idPerson = str_to_int(request.form.get("idPerson"))
	person_admin = PersonProfile(idPerson).get_admin()
	if person_admin['name'] != "Admin":
		delete_person_profile(idPerson)
		return redirect("/pessoas/lista")
	else: 
		whoops = """Este perfil não pode ser deletado, por favor selecione outra pessoa 
					da lista."""
		people_list = CompanyProfile(session["idCompany"]).get_people()
		return render_template("people_list.html", header = get_header(session), 
								people_list = people_list, whoops = whoops)
예제 #8
0
def people_edit_data(idWho):
	""" It receives the person's id and checks if the user can edit that person's
	data. Then it proceeds in getting a list of all data for that person 
	and returns the people_register_data page """
	idWho = validate_person_idwho(idWho, session['idCompany'])
	if idWho:
		person_data = PersonProfile(idWho).get_data()
		return render_template("people_register_data.html", 
								combined_data = person_data, 
								header = get_header(session),
								person_id = idWho)
	else: 
		whoops = "Este perfil não existe, por favor selecione uma pessoa da lista."
		people_list = CompanyProfile(session["idCompany"]).get_people()
		return render_template("people_list.html", header = get_header(session), 
								people_list = people_list, whoops = whoops)
예제 #9
0
def benefits_profile(idWho):
	""" Receives the benefit's id (idWho) and checks if the user is allowed to see
	that benefit's profile. This is an upgrade from the last version in which anyone could 
	see any benefit, even if the user's company wasn't registered with that benefit. If that
	is the case an alert is shown to the user. Otherwise the benefit profile is returned."""
	idWho = validate_benefit_idwho(idWho, session['idCompany'])
	if idWho:
		profile = BenefitProfile(idWho).get_profile()
		benefit_people = BenefitProfile(idWho).get_people_by_company(session['idCompany'])
		return render_template("benefits_profile.html", header = get_header(session),
								profile = profile, benefit_people = benefit_people)
	else:
		whoops = "Este perfil não existe, por favor selecione um benefício da lista."
		benefits_list = CompanyProfile(session["idCompany"]).get_benefits()
		return render_template("benefits_list.html", header = get_header(session), 
								benefits_list = benefits_list, whoops = whoops)
예제 #10
0
def people_registration():
	""" This is a more complex function. First a list of all benefits registered with the 
	company is generated. If 'GET' method, returns the people registration page along with 
	the list of all benefits registered with the user's company. 
	If 'POST', it checks if both Person' name has been entered and if the cpf is a valid 
	cpf number in the correct cpf format, if not returns the registration page with an alert 
	(whoops). If valid, it calls the register new person function which will procced to check the 
	validity of the cpf entered against the person database/table. If everything goes well, 
	the function checks if a benefit was selected (or more) during registration. 
	If so, the person is also registered with those benefits. If that is the case the
	people_register_data page is returned to continue the data registration process. If not,
	an updated list of all company people is returned."""
	company_benefits = CompanyProfile(session['idCompany']).get_benefits()
	if request.method == 'POST':
		name = request.form.get("name")
		cpf = request.form.get("cpf")
		chosen_benefits = str_list_to_int(request.form.getlist("benefits"))
		if name and isCpfValid(cpf):
			if not get_person_id_by_cpf(cpf):
				new_person_id = register_new_person(name, cpf, session['idCompany'])
				if len(chosen_benefits) > 0:
					for benefit_id in chosen_benefits:
						register_person_to_benefit(new_person_id, benefit_id)
					combined_data = get_combined_data_for_person(chosen_benefits, new_person_id)
					return render_template("people_register_data.html",
															header = get_header(session),
															person_id = new_person_id,
															combined_data = combined_data)
				else:
					return redirect("/pessoas/lista")
			else:
				whoops = "Essa pessoa já está registrada"
				return render_template("people_registration.html", header = get_header(session), 
																whoops = whoops)
		else:
			whoops = "Por favor insira um nome e um número de cpf válido"
			return render_template("people_registration.html", header = get_header(session), 
															whoops = whoops)
	else: # 'GET'
		return render_template("people_registration.html", header = get_header(session), 
														benefits = company_benefits)
예제 #11
0
def login():
	""" This function receives the user's cpf and checks it's values before 
	allowing them to login. There's no security measure implemented whatsoever. 
	If the cpf matches one of the admins, it proceeds to load all information 
	necessary on the session (dict) for further use regarding the user and 
	their company."""
	session.clear()
	if request.method == "POST":
		cpf = request.form.get("cpf")
		if not cpf:
			whoops = "Por favor insira seu CPF"
			return render_template("login.html", header = get_header(session),
												whoops = whoops)
		if not isCpfValid(cpf):
			whoops = "Número de CPF não válido"
			return render_template("login.html", header = get_header(session),
												whoops = whoops)
		person_id = get_person_id_by_cpf(cpf)
		if person_id is None:
			whoops = "Número de CPF não encontrado"
			return render_template("login.html", header = get_header(session),
												whoops = whoops)
		person_profile = PersonProfile(person_id).get_profile()
		if person_profile['admin']['level'] == 0:
			whoops = (person_profile['name'] + ", você não tem autorização para entrar no sistema")
			return render_template("login.html", header = get_header(session),
											whoops = whoops)
		company_name = CompanyProfile(person_profile['idCompany']).get_name()
		session["id"] = person_profile['id']
		session["name"] = person_profile['name']
		session["idCompany"] = person_profile['idCompany']
		session["company"] = company_name
		session["admin_name"] = person_profile['admin']['name']
		return redirect("/")
	else: # 'GET'
		return render_template("login.html", header = get_header(session))
예제 #12
0
    def setUp(self):
        call("./setup/start_testing.sh")

        self.profile_one = CompanyProfile(1)
        self.profile_two = CompanyProfile(2)
        self.profile_three = CompanyProfile(3)
예제 #13
0
class TestGetBenefits(unittest.TestCase):
    def setUp(self):
        call("./setup/start_testing.sh")

        self.profile_one = CompanyProfile(1)
        self.profile_two = CompanyProfile(2)
        self.profile_three = CompanyProfile(3)

    def tearDown(self):
        call("./setup/finish_testing.sh")

    def test_get_company_benefits_one(self):
        actual_result = self.profile_one.get_benefits()
        expected_result = [{
            'idBenefit': 3,
            'name': 'Plano Dental Sorriso'
        }, {
            'idBenefit': 4,
            'name': 'Plano de Saúde Mente Sã, Corpo São'
        }, {
            'idBenefit': 1,
            'name': 'Plano de Saúde Norte Europa'
        }, {
            'idBenefit': 2,
            'name': 'Plano de Saúde Pampulha Intermédica'
        }]
        self.assertEqual(actual_result, expected_result)

    def test_get_company_benefits_two(self):
        actual_result = self.profile_two.get_benefits()
        expected_result = [{
            'idBenefit': 3,
            'name': 'Plano Dental Sorriso'
        }, {
            'idBenefit': 4,
            'name': 'Plano de Saúde Mente Sã, Corpo São'
        }, {
            'idBenefit': 2,
            'name': 'Plano de Saúde Pampulha Intermédica'
        }]
        self.assertEqual(actual_result, expected_result)

    def test_get_company_benefits_three(self):
        actual_result = self.profile_three.get_benefits()
        expected_result = [{
            'idBenefit': 3,
            'name': 'Plano Dental Sorriso'
        }, {
            'idBenefit': 1,
            'name': 'Plano de Saúde Norte Europa'
        }]
        self.assertEqual(actual_result, expected_result)

    def test_get_company_benefits_company_doesnt_exist(self):
        with self.assertRaises(Exception):
            CompanyProfile(911111123999).get_benefits()

    def test_get_company_benefits_string_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile("1").get_benefits()

    def test_get_company_benefits_float_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(1.3).get_benefits()

    def test_get_company_benefits_datatype_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(str).get_benefits()

    def test_get_company_benefits_none_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(None).get_benefits()

    def test_get_company_benefits_empy_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile().get_benefits()

    def test_get_company_benefits_boolean_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(False).get_benefits()
예제 #14
0
 def test_get_company_people_boolean_input(self):
     with self.assertRaises(TypeError):
         CompanyProfile(True).get_people()
예제 #15
0
 def test_get_company_people_empy_input(self):
     with self.assertRaises(TypeError):
         CompanyProfile().get_people()
예제 #16
0
 def test_get_company_people_datatype_input(self):
     with self.assertRaises(TypeError):
         CompanyProfile(str).get_people()
예제 #17
0
 def test_get_company_people_company_doesnt_exist(self):
     with self.assertRaises(Exception):
         CompanyProfile(9999).get_people()
예제 #18
0
 def test_get_profile_float_input(self):
     with self.assertRaises(TypeError):
         CompanyProfile(9.9203984).get_name()
예제 #19
0
 def test_get_company_name_none_input(self):
     with self.assertRaises(TypeError):
         CompanyProfile(None).get_name()
예제 #20
0
class TestGetProfile(unittest.TestCase):
    def setUp(self):
        call("./setup/start_testing.sh")

        self.profile_one = CompanyProfile(1)
        self.profile_two = CompanyProfile(2)
        self.profile_three = CompanyProfile(3)

        self.profile_one_data = {
            "id":
            1,
            "name":
            "Wonka Industries",
            "people": [{
                'idPerson': 5,
                'name': 'Fernando Augusto Rodrigues'
            }, {
                'idPerson': 13,
                'name': 'João Patricio'
            }, {
                'idPerson': 4,
                'name': 'Mariana Fagundes'
            }, {
                'idPerson': 14,
                'name': 'Marília Roberta Almeida'
            }, {
                'idPerson': 6,
                'name': 'Paula Macedo Gomes'
            }, {
                'idPerson': 1,
                'name': 'Pessoa da Wonka'
            }],
            "benefits": [{
                'idBenefit': 3,
                'name': 'Plano Dental Sorriso'
            }, {
                'idBenefit': 4,
                'name': 'Plano de Saúde Mente Sã, Corpo São'
            }, {
                'idBenefit': 1,
                'name': 'Plano de Saúde Norte Europa'
            }, {
                'idBenefit': 2,
                'name': 'Plano de Saúde Pampulha Intermédica'
            }]
        }
        self.profile_two_data = {
            "id":
            2,
            "name":
            "Tio Patinhas Bank",
            "people": [{
                'idPerson': 2,
                'name': 'Pessoa da Tio Patinhas'
            }, {
                'idPerson': 8,
                'name': 'Rafaela Dias Silva'
            }, {
                'idPerson': 7,
                'name': 'Ricardo Pontes'
            }, {
                'idPerson': 9,
                'name': 'Romario Pacheco'
            }],
            "benefits": [{
                'idBenefit': 3,
                'name': 'Plano Dental Sorriso'
            }, {
                'idBenefit': 4,
                'name': 'Plano de Saúde Mente Sã, Corpo São'
            }, {
                'idBenefit': 2,
                'name': 'Plano de Saúde Pampulha Intermédica'
            }]
        }
        self.profile_three_data = {
            "id":
            3,
            "name":
            "Acme Co",
            "people": [{
                'idPerson': 10,
                'name': 'Augusto Wozniak'
            }, {
                'idPerson': 11,
                'name': 'Otavio Oliveira'
            }, {
                'idPerson': 3,
                'name': 'Pessoa da Acme'
            }, {
                'idPerson': 12,
                'name': 'Waldisney Gates'
            }],
            "benefits": [{
                'idBenefit': 3,
                'name': 'Plano Dental Sorriso'
            }, {
                'idBenefit': 1,
                'name': 'Plano de Saúde Norte Europa'
            }]
        }

    def tearDown(self):
        call("./setup/finish_testing.sh")

    def test_get_profile_one(self):
        for key in self.profile_one_data.keys():
            actual_result = self.profile_one.get_profile().get(key)
            expected_result = self.profile_one_data.get(key)
            self.assertEqual(actual_result, expected_result)

    def test_get_profile_two(self):
        for key in self.profile_two_data.keys():
            actual_result = self.profile_two.get_profile().get(key)
            expected_result = self.profile_two_data.get(key)
            self.assertEqual(actual_result, expected_result)

    def test_get_profile_three(self):
        for key in self.profile_three_data.keys():
            actual_result = self.profile_three.get_profile().get(key)
            expected_result = self.profile_three_data.get(key)
            self.assertEqual(actual_result, expected_result)

    def test_get_profile_company_doesnt_exist(self):
        with self.assertRaises(Exception):
            CompanyProfile(0).get_name()

    def test_get_profile_string_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile("hello").get_name()

    def test_get_profile_float_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(9.9203984).get_name()

    def test_get_profile_datatype_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(int).get_name()

    def test_get_profile_name_none_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(None).get_name()

    def test_get_profile_name_empy_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile().get_name()

    def test_get_profile_name_boolean_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(False).get_name()
예제 #21
0
 def test_get_company_benefits_empy_input(self):
     with self.assertRaises(TypeError):
         CompanyProfile().get_benefits()
예제 #22
0
 def test_get_profile_name_boolean_input(self):
     with self.assertRaises(TypeError):
         CompanyProfile(False).get_name()
예제 #23
0
 def test_get_profile_datatype_input(self):
     with self.assertRaises(TypeError):
         CompanyProfile(int).get_name()
예제 #24
0
 def test_get_company_benefits_company_doesnt_exist(self):
     with self.assertRaises(Exception):
         CompanyProfile(911111123999).get_benefits()
예제 #25
0
 def test_get_company_benefits_datatype_input(self):
     with self.assertRaises(TypeError):
         CompanyProfile(str).get_benefits()
예제 #26
0
class TestGetPeople(unittest.TestCase):
    def setUp(self):
        call("./setup/start_testing.sh")

        self.profile_one = CompanyProfile(1)
        self.profile_two = CompanyProfile(2)
        self.profile_three = CompanyProfile(3)

    def tearDown(self):
        call("./setup/finish_testing.sh")

    def test_get_company_people_one(self):
        actual_result = self.profile_one.get_people()
        expected_result = [{
            'idPerson': 5,
            'name': 'Fernando Augusto Rodrigues'
        }, {
            'idPerson': 13,
            'name': 'João Patricio'
        }, {
            'idPerson': 4,
            'name': 'Mariana Fagundes'
        }, {
            'idPerson': 14,
            'name': 'Marília Roberta Almeida'
        }, {
            'idPerson': 6,
            'name': 'Paula Macedo Gomes'
        }, {
            'idPerson': 1,
            'name': 'Pessoa da Wonka'
        }]
        self.assertEqual(actual_result, expected_result)

    def test_get_company_people_two(self):
        actual_result = self.profile_two.get_people()
        expected_result = [{
            'idPerson': 2,
            'name': 'Pessoa da Tio Patinhas'
        }, {
            'idPerson': 8,
            'name': 'Rafaela Dias Silva'
        }, {
            'idPerson': 7,
            'name': 'Ricardo Pontes'
        }, {
            'idPerson': 9,
            'name': 'Romario Pacheco'
        }]
        self.assertEqual(actual_result, expected_result)

    def test_get_company_people_three(self):
        actual_result = self.profile_three.get_people()
        expected_result = [{
            'idPerson': 10,
            'name': 'Augusto Wozniak'
        }, {
            'idPerson': 11,
            'name': 'Otavio Oliveira'
        }, {
            'idPerson': 3,
            'name': 'Pessoa da Acme'
        }, {
            'idPerson': 12,
            'name': 'Waldisney Gates'
        }]
        self.assertEqual(actual_result, expected_result)

    def test_get_company_people_company_doesnt_exist(self):
        with self.assertRaises(Exception):
            CompanyProfile(9999).get_people()

    def test_get_company_people_string_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile("1").get_people()

    def test_get_company_people_float_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(1.3).get_people()

    def test_get_company_people_datatype_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(str).get_people()

    def test_get_company_people_none_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(None).get_people()

    def test_get_company_people_empy_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile().get_people()

    def test_get_company_people_boolean_input(self):
        with self.assertRaises(TypeError):
            CompanyProfile(True).get_people()
예제 #27
0
 def test_get_company_benefits_boolean_input(self):
     with self.assertRaises(TypeError):
         CompanyProfile(False).get_benefits()
예제 #28
0
 def test_get_company_name_string_input(self):
     with self.assertRaises(TypeError):
         CompanyProfile("1").get_name()
예제 #29
0
    def setUp(self):
        call("./setup/start_testing.sh")

        self.profile_one = CompanyProfile(1)
        self.profile_two = CompanyProfile(2)
        self.profile_three = CompanyProfile(3)

        self.profile_one_data = {
            "id":
            1,
            "name":
            "Wonka Industries",
            "people": [{
                'idPerson': 5,
                'name': 'Fernando Augusto Rodrigues'
            }, {
                'idPerson': 13,
                'name': 'João Patricio'
            }, {
                'idPerson': 4,
                'name': 'Mariana Fagundes'
            }, {
                'idPerson': 14,
                'name': 'Marília Roberta Almeida'
            }, {
                'idPerson': 6,
                'name': 'Paula Macedo Gomes'
            }, {
                'idPerson': 1,
                'name': 'Pessoa da Wonka'
            }],
            "benefits": [{
                'idBenefit': 3,
                'name': 'Plano Dental Sorriso'
            }, {
                'idBenefit': 4,
                'name': 'Plano de Saúde Mente Sã, Corpo São'
            }, {
                'idBenefit': 1,
                'name': 'Plano de Saúde Norte Europa'
            }, {
                'idBenefit': 2,
                'name': 'Plano de Saúde Pampulha Intermédica'
            }]
        }
        self.profile_two_data = {
            "id":
            2,
            "name":
            "Tio Patinhas Bank",
            "people": [{
                'idPerson': 2,
                'name': 'Pessoa da Tio Patinhas'
            }, {
                'idPerson': 8,
                'name': 'Rafaela Dias Silva'
            }, {
                'idPerson': 7,
                'name': 'Ricardo Pontes'
            }, {
                'idPerson': 9,
                'name': 'Romario Pacheco'
            }],
            "benefits": [{
                'idBenefit': 3,
                'name': 'Plano Dental Sorriso'
            }, {
                'idBenefit': 4,
                'name': 'Plano de Saúde Mente Sã, Corpo São'
            }, {
                'idBenefit': 2,
                'name': 'Plano de Saúde Pampulha Intermédica'
            }]
        }
        self.profile_three_data = {
            "id":
            3,
            "name":
            "Acme Co",
            "people": [{
                'idPerson': 10,
                'name': 'Augusto Wozniak'
            }, {
                'idPerson': 11,
                'name': 'Otavio Oliveira'
            }, {
                'idPerson': 3,
                'name': 'Pessoa da Acme'
            }, {
                'idPerson': 12,
                'name': 'Waldisney Gates'
            }],
            "benefits": [{
                'idBenefit': 3,
                'name': 'Plano Dental Sorriso'
            }, {
                'idBenefit': 1,
                'name': 'Plano de Saúde Norte Europa'
            }]
        }
예제 #30
0
 def test_get_company_name_float_input(self):
     with self.assertRaises(TypeError):
         CompanyProfile(1.3).get_name()