Exemplo n.º 1
0
 def get_not_seen_notifications_number_by_email(
         user_email, is_negative=False):
     user_id = DBGeneral.select_where_email(
         "id", Constants.DBConstants.IceTables.USER_PROFILE, user_email)
     notifications_number = DBGeneral.select_where_and(
         Constants.DBConstants.Queries.COUNT,
         Constants.DBConstants.IceTables.NOTIFICATION,
         "user_id",
         user_id,
         "is_read",
         "False",
         1)
     if is_negative:
         counter = 0
         while notifications_number != "0" and counter <= Constants.\
                 Dashboard.Avatar.Notifications.Count.RETRIES_NUMBER:
             notifications_number = DBGeneral.select_where_and(
                 Constants.DBConstants.Queries.COUNT,
                 Constants.DBConstants.IceTables.NOTIFICATION,
                 "user_id",
                 user_id,
                 "is_read",
                 "False",
                 1)
             time.sleep(1)
             counter += 1
     return notifications_number
Exemplo n.º 2
0
 def invite_team_member(user_content):
     r1 = None
     postURL = settings.ICE_EM_URL + '/v1/engmgr/invite-team-members/'
     logger.debug("Post invite user URL: " + postURL)
     headers = dict()  # Create header for post request.
     headers['Content-type'] = 'application/json'
     headers['Authorization'] = user_content['session_token']
     data = dict()  # Create JSON data for post request.
     data['email'] = Helper.rand_string(
         'randomString') + "@" + ServiceProvider.email
     data['eng_uuid'] = user_content['engagement_uuid']
     list_data = []
     list_data.append(data)
     try:
         r1 = requests.post(postURL,
                            json=list_data,
                            headers=headers,
                            verify=False)
         Helper.internal_assert_boolean(r1.status_code, 200)
         logger.debug("Invite sent successfully to email " + data['email'])
         invite_token = DBGeneral.select_where_and(
             "invitation_token", "ice_invitation", "email", data['email'],
             "engagement_uuid", user_content['engagement_uuid'], 1)
         invite_url = settings.ICE_PORTAL_URL + "/#/signUp?invitation=" + \
             invite_token + "&email=" + data['email']
         logger.debug("Invitation URL is: " + invite_url)
         return data['email'], invite_token, invite_url
     except BaseException:
         if r1 is None:
             logger.error("Failed to invite team member.")
         else:
             logger.error("POST request failed to invite team member, " +
                          "see response >>> %s %s" %
                          (r1.status_code, r1.reason))
         raise
 def remove_vfc(user_content):
     vf_id = DBGeneral.select_where("uuid", "ice_vf", "name",
                                    user_content['vfName'], 1)
     djoni_uuid = None
     counter = 0
     while not djoni_uuid and counter <= Constants.DBConstants.\
             RETRIES_NUMBER:
         time.sleep(session.wait_until_time_pause_long)
         djoni_uuid = DBGeneral.select_where_and("uuid", "ice_vfc", "vf_id",
                                                 vf_id, "name", "djoni", 1)
         logger.debug("Checklist state not changed yet  (%s of %s)" %
                      (counter, Constants.DBConstants.RETRIES_NUMBER))
         counter += 1
     logger.debug("VFC_UUID was successfully selecteded : " + djoni_uuid +
                  ", and was verified over the DB")
     Wait.text_by_id(Constants.Dashboard.DetailedView.VFC.ID + "djoni",
                     "djoni (loka)",
                     wait_for_page=True)
     Wait.text_by_id(Constants.Dashboard.DetailedView.VFC.ID + "djoni2",
                     "djoni2 (loka2)",
                     wait_for_page=True)
     Click.id(Constants.Dashboard.DetailedView.VFC.ID + "djoni",
              wait_for_page=True)
     Click.id(Constants.Dashboard.DetailedView.VFC.Remove.ID + djoni_uuid,
              wait_for_page=True)
Exemplo n.º 4
0
 def update_decisions(checklistUuid, checklistName):
     checklistTempid = DBGeneral.select_where("template_id",
                                              "ice_checklist", "name",
                                              checklistName, 1)
     checklistLineItems = DBGeneral.select_where_and(
         "uuid", "ice_checklist_line_item", "line_type", "auto",
         "template_id", checklistTempid, 0)
     for lineItem in checklistLineItems:
         setParametrType2 = "peer_review_value"
         setParametrValue2 = "approved"
         whereParametrType2 = "lineitem_id"
         whereParametrValue2 = lineItem
         DBGeneral.update_where_and("ice_checklist_decision",
                                    "review_value", checklistUuid,
                                    "approved", "checklist_id",
                                    setParametrType2, setParametrValue2,
                                    whereParametrType2, whereParametrValue2)
Exemplo n.º 5
0
 def select_el_email(vfName):
     try:
         # Fetch one AT&T user ID.
         engagement_id = DBVirtualFunction.select_eng_uuid(vfName)
         engagement_manual_id = DBGeneral.select_where(
             "engagement_manual_id", "ice_engagement", "uuid",
             engagement_id, 1)
         reviewer_id = DBGeneral.select_where(
             "reviewer_id",
             "ice_engagement",
             "engagement_manual_id",
             engagement_manual_id,
             1)
         engLeadEmail = DBGeneral.select_where_and(
             "email", "ice_user_profile", "id", reviewer_id, "role_id",
             "2", 1)
         return engLeadEmail
     # If failed - count the failure and add the error to list of errors.
     except BaseException:
         errorMsg = "select_el_email FAILED "
         raise Exception(errorMsg, "select_el_email")
Exemplo n.º 6
0
 def add_contact(user_content):
     r1 = None
     postURL = settings.ICE_EM_URL + '/v1/engmgr/add-contact/'
     logger.debug("Post invite vendor contact URL: " + postURL)
     headers = dict()  # Create header for post request.
     headers['Content-type'] = 'application/json'
     headers['Authorization'] = user_content['session_token']
     data = dict()  # Create JSON data for post request.
     data['company'] = user_content['vendor_uuid']
     data['email'] = Helper.rand_string(
         'randomString') + "@" + ServiceProvider.email
     data['eng_uuid'] = user_content['engagement_uuid']
     data['full_name'] = Helper.rand_string('randomString')
     data['phone_number'] = "+1201" + Helper.rand_string("randomNumber", 6)
     try:
         r1 = requests.post(postURL,
                            json=data,
                            headers=headers,
                            verify=False)
         Helper.internal_assert_boolean(r1.status_code, 200)
         logger.debug("Invite sent successfully to email " + data['email'])
         invite_token = DBGeneral.select_where_and(
             "invitation_token", "ice_invitation", "email", data['email'],
             "engagement_uuid", user_content['engagement_uuid'], 1)
         invite_url = settings.ICE_PORTAL_URL + "/#/signUp?invitation=" +\
             invite_token + "&email=" + data['email'] +\
             "&full_name=" + data['full_name'] + \
             "&phone_number=" + data['phone_number'] + "&company=" + \
             data['company'] + "&is_contact_user=true"
         logger.debug("Invitation URL is: " + invite_url)
         return data['email'], invite_token, invite_url
     except BaseException:
         if r1 is None:
             logger.error("Failed to invite vendor contact.")
         else:
             logger.error(
                 "POST request failed to invite vendor contact, " +
                 "see response >>> %s %s \n %s" %
                 (r1.status_code, r1.reason, str(r1.content, 'utf-8')))
         raise