Пример #1
0
def createCompany():
    req_json = request.get_json()
    try:
        exception_helper.getCompanyTargetofJson(req_json)
        post_business_helper.createCompany(req_json)
        return make_response({'Success': 'Company has been created'}, 200)
    except (TypeError, ValueError) as e:
        json_message = jsonify({'error': '\'%s\'' % (e)})
        return make_response(json_message, 400)
    except (Exception) as e:
        json_message = jsonify({'database error': '\'%s\'' % (e)})
        return make_response(json_message, 400)
 def test_create_company_valid(self):
     json = {
         "company_name": "Unit Test "
         + str(randint(0, 20))
         + "_"
         + str(randint(0, 20)),
         "email_group": "unitest"
         + str(randint(0, 20))
         + "-"
         + str(randint(0, 20))
         + ".gob",
         "ruc": "12345678" + str(randint(200, 900)),
         "phone": "998123123",
         "contact_person": "Test",
         "address": "Prueba",
     }
     post_business_helper.createCompany(json)