示例#1
0
 def validate_feedback(description, user_email):
     query = "SELECT user_id FROM ice_feedback where " +\
         "description = '{desc}'".format(
             desc=description)
     feedback_user_uuid = DBGeneral.select_query(query)
     query = "SELECT id FROM ice_user_profile  where " +\
         "email = '{email}'".format(
             email=user_email)
     user_uuid = DBGeneral.select_query(query)
     Helper.internal_assert(user_uuid, feedback_user_uuid)
 def get_engagement():
     """Use this function instead of creating a new """ +\
         """engagement where no need to"""
     queryStr = "SELECT DISTINCT ice_engagement.uuid, " +\
         "engagement_manual_id, ice_vf.name, ice_user_profile.full_name, \
                 ice_user_profile.email, reviewer_table.full_name, " +\
         "reviewer_table.email, \
                 ice_deployment_target.version, ice_ecomp_release.name \
                 FROM ice_engagement LEFT JOIN ice_vf ON engagement_id " +\
         "= ice_engagement.uuid \
                 LEFT JOIN ice_user_profile reviewer_table ON " +\
         "reviewer_table.id = ice_engagement.reviewer_id \
                 LEFT JOIN ice_user_profile ON ice_user_profile.id = " +\
         "ice_engagement.peer_reviewer_id \
                 LEFT JOIN ice_deployment_target ON " +\
         "ice_deployment_target.uuid = " +\
         "ice_vf.deployment_target_id \
                 LEFT JOIN ice_ecomp_release ON " +\
         "ice_ecomp_release.uuid = ice_vf.ecomp_release_id \
                 WHERE ice_user_profile.id IS NOT NULL LIMIT 1;"
     list_of_values = DBGeneral.select_query(queryStr, return_type="list")
     list_of_keys = [
         "engagement_uuid",
         "engagement_manual_id",
         "vfName",
         "pr_name",
         "pr_email",
         "el_name",
         "el_email",
         "target_aic",
         "ecomp_release"]
     return dict(zip(list_of_keys, list_of_values))
示例#3
0
 def rollback_for_el_not_in_engagement():
     query_str = "select uuid from ice_user_profile where full_name = " +\
         "'el_for_test';"
     user_uuid = DBGeneral.select_query(query_str)
     fullName = DBBridge.helper_rand_string("randomString")
     updatequery = "UPDATE ice_user_profile SET role_id=1,full_name " +\
         "= '%s' WHERE uuid = '%s'  ;" % (fullName, user_uuid)
     DBGeneral.update_query(updatequery)
示例#4
0
 def select_el_not_in_engagement(el_name, pr_name):
     query_str = "select full_name from ice_user_profile where " +\
         "role_id = 2 and full_name != '%s' and full_name != '%s';" % (
             el_name, pr_name)
     new_user = DBGeneral.select_query(query_str)
     if new_user == 'None':
         new_user = DBUser.update_to_el_not_in_engagement()
     return new_user
示例#5
0
 def create_editing_cl_template_if_not_exist():
     template_id = DBGeneral.select_query(
         ("""SELECT uuid FROM public.ice_checklist_template """ +
          """where name = '{s}'""").format(
              s=Constants.Dashboard.LeftPanel.EditChecklistTemplate.HEAT))
     if template_id == 'None':
         DBChecklist.create_default_heat_teampleate()
         session.createTemplatecount = True
示例#6
0
 def checkChecklistIsUpdated():
     query = "select uuid from ice_checklist_section where template_id " +\
         "in (select template_id from ice_checklist_template where " +\
         "name='{template_name}') and name='{section_name}'".format(
             template_name=Constants.Dashboard.LeftPanel.
             EditChecklistTemplate.HEAT, section_name=Constants.
             Dashboard.LeftPanel.EditChecklistTemplate.HEAT)
     return DBGeneral.select_query(query)
示例#7
0
    def set_engagement_peer_reviewer(engagement_uuid, email):
        user_uuid = DBUser.select_user_uuid(email)
        update_query = "UPDATE ice_user_profile SET role_id=2 WHERE " +\
            "uuid = '%s';" % user_uuid
        DBGeneral.update_query(update_query)

        user_id = DBGeneral.select_query(
            "SELECT id FROM ice_user_profile WHERE uuid = '%s';" % user_uuid)
        update_query = "UPDATE ice_engagement SET peer_reviewer_id=%s " +\
            "WHERE uuid = '%s';" % (
                user_id, engagement_uuid)
        DBGeneral.update_query(update_query)
示例#8
0
 def update_to_el_not_in_engagement():
     query_str = "select uuid from ice_user_profile where role_id = 1 ;"
     user_uuid = DBGeneral.select_query(query_str)
     updatequery = "UPDATE ice_user_profile SET role_id=2 ,full_name" +\
         " = 'el_for_test' WHERE uuid = '%s' ;" % (
             user_uuid)
     DBGeneral.update_query(updatequery)
     updatequery = "UPDATE ice_user_profile SET role_id=2 WHERE " +\
         "full_name = '%s' ;" % (
             'el_for_test')
     DBGeneral.update_query(updatequery)
     return 'el_for_test'
 def remove_deployment_target(user_content):
     Wait.text_by_id("visible-dts-Lisle (DPA3)",
                     "Lisle (DPA3)",
                     wait_for_page=True)
     dt_site_id = DBGeneral.select_query(
         "SELECT uuid FROM public.ice_deployment_target_site where name" +
         " = 'Lisle (DPA3)'")
     Click.id("visible-dts-Lisle (DPA3)")
     Wait.id(
         Constants.Dashboard.DetailedView.DeploymentTarget.ID_REMOVE_DTS +
         dt_site_id)
     Click.id(
         Constants.Dashboard.DetailedView.DeploymentTarget.ID_REMOVE_DTS +
         dt_site_id,
         wait_for_page=True)
     session.run_negative(
         lambda: Wait.text_by_id("visible-dts-Lisle (DPA3)",
                                 "Lisle (DPA3)",
                                 wait_for_page=True),
         "Negative test failed at wait text Lisle (DPA3)")
示例#10
0
 def get_email_by_full_name(fullname):
     #         try:
     query_str = "select email from ice_user_profile where " +\
         "full_name = '%s';" % (fullname)
     user_email = DBGeneral.select_query(query_str)
     return user_email
示例#11
0
 def create_default_heat_teampleate():
     template_query = "INSERT INTO public.ice_checklist_template(uuid, " +\
         "name, category, version, create_time)"\
         "VALUES ('%s', '%s', '%s', '%s', '%s');" % (
             str(uuid4()), 'Editing Heat', 'first category', '1',
             timezone.now())
     DBGeneral.insert_query(template_query)
     template_id = DBGeneral.select_query(
         "SELECT uuid FROM public.ice_checklist_template where " +
         "name = 'Editing Heat'")
     # SECTIONS
     section1_query = "INSERT INTO public.ice_checklist_section(uuid, " +\
         "name, weight, description, validation_instructions, " +\
         "create_time, template_id) "\
         "VALUES ('%s', '%s', '%s', '%s', '%s','%s', '%s');" % (
             str(uuid4()), 'External References',
             '1', 'section descripyion', 'valid instructions',
             timezone.now(), template_id)
     DBGeneral.insert_query(section1_query)
     section1_id = DBGeneral.select_query(
         ("""SELECT uuid FROM public.ice_checklist_section """ +
          """where name = 'External References' """ +
          """and template_id = '{s}'""").format(s=template_id))
     section2_query = "INSERT INTO public.ice_checklist_section(uuid, " +\
         "name, weight, description, validation_instructions, " +\
         "create_time, template_id) "\
         "VALUES ('%s', '%s', '%s', '%s', '%s','%s', '%s');" % (
             str(uuid4()), 'Parameter Specification',
             '2', 'section descripyion', 'valid instructions',
             timezone.now(), template_id)
     DBGeneral.insert_query(section2_query)
     section2_id = DBGeneral.select_query(
         ("""SELECT uuid FROM public.ice_checklist_section """ +
          """where name = """ +
          """'Parameter Specification' and template_id = '{s}'""").format(
              s=template_id))
     # Line items
     line_item1 = \
         "INSERT INTO public.ice_checklist_line_item(uuid, " +\
         "name, weight, description, line_type, validation_instructions," +\
         "create_time,section_id, template_id) "\
         "VALUES ('%s', '%s', " % (str(uuid4()), 'Normal references') +\
         "'%s', " % '1' +\
         "'%s'," % 'Numeric parameters should include ' +\
         'range and/or allowed values.' +\
         " '%s'," % 'manual', +\
         "'%s'" % 'Here are some useful tips ' +\
         'for how to validate this item ' +\
         'in the most awesome way:<br><br><ul><li>Here is my ' +\
         'awesome tip 1</li><li>Here is my awesome tip 2</li><li>' +\
         'Here is my awesome tip 3</li></ul>' +\
         ", '%s'" % timezone.now() +\
         ", '%s'," % section1_id +\
         " '%s');" % template_id
     DBGeneral.insert_query(line_item1)
     line_item2 = "INSERT INTO public.ice_checklist_line_item(uuid, " +\
         "name, weight, description, line_type, validation_instructions," +\
         "create_time, section_id, template_id) "\
         "VALUES ('%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s');" % (
             str(uuid4()), 'String parameters', '2',
             'Numeric parameters should include range ' +
             'and/or allowed values.', 'auto',
             'Here are some useful tips for how to validate this item ' +
             'in the most awesome way:<br><br><ul><li>Here is my ' +
             'awesome tip 1</li><li>Here is my awesome tip 2</li><li>' +
             'Here is my awesome tip 3</li></ul>', timezone.now(),
             section2_id, template_id)
     DBGeneral.insert_query(line_item2)
     line_item3 = "INSERT INTO public.ice_checklist_line_item(uuid, " +\
         "name, weight, description, line_type, validation_instructions," +\
         "create_time,section_id, template_id) "\
         "VALUES ('%s', '%s', '%s', '%s', '%s','%s', " +\
         "'%s', '%s', '%s');" % (
             str(uuid4()), 'Numeric parameters', '3',
             'Numeric parameters should include range and/or ' +
             'allowed values.', 'manual',
             'Here are some useful tips for how to validate this item ' +
             'in the most awesome way:<br><br><ul><li>Here is my ' +
             'awesome tip 1</li><li>Here is my awesome tip 2</li><li>' +
             'Here is my awesome tip 3</li></ul>', timezone.now(),
             section2_id, template_id)
     DBGeneral.insert_query(line_item3)
     line_item4 = "INSERT INTO public.ice_checklist_line_item(uuid, " +\
         "name, weight, description, line_type, " +\
         "validation_instructions,create_time, section_id, " +\
         "template_id) "\
         "VALUES ('%s', '%s', '%s', '%s', '%s','%s', '%s', " +\
         "'%s', '%s');" % (
             str(uuid4()), 'VF image', '2',
             'Numeric parameters should include range and/or ' +
             'allowed values.', 'auto',
             'Here are some useful tips for how to validate this ' +
             'item in the most awesome way:<br><br><ul><li>Here is ' +
             'my awesome tip 1</li><li>Here is my awesome tip 2' +
             '</li><li>Here is my awesome tip 3</li></ul>',
             timezone.now(), section1_id, template_id)
     DBGeneral.insert_query(line_item4)
     line_item5 = "INSERT INTO public.ice_checklist_line_item(uuid, " +\
         "name, weight, description, line_type, validation_instructions," +\
         "create_time,section_id, template_id) "\
         "VALUES ('%s', '%s', '%s', '%s', '%s','%s', '%s'," +\
         " '%s', '%s');" % (str(
             uuid4()), 'Parameters', '1',
             'Numeric parameters should include range ' +
             'and/or allowed values.', 'auto',
             'Here are some useful tips for how to validate this item ' +
             'in the most awesome way:<br><br><ul><li>Here is my awesome ' +
             'tip 1</li><li>Here is my awesome tip 2</li><li>Here is my ' +
             'awesome tip 3</li></ul>', timezone.now(), section2_id,
             template_id)
     DBGeneral.insert_query(line_item5)
示例#12
0
 def fetchChecklistByName(checklistName):
     query = "select uuid from ice_checklist where " +\
         "name='{cl_name}'".format(
             cl_name=checklistName)
     return DBGeneral.select_query(query)
 def select_vf_name_by_vf_version(version_name):
     queryofname = "SELECT name FROM ice_vf WHERE " +\
         "version= '%s';" % version_name
     vfNameDb = str(DBGeneral.select_query(queryofname))
     return vfNameDb
 def select_vf_version_by_vf_name(vfName):
     queryStr = "SELECT version FROM ice_vf WHERE name= '%s';" % vfName
     version_name = str(DBGeneral.select_query(queryStr))
     return version_name
 def select_next_steps_uuids_by_stage(engagement_uuid, engagement_stage):
     query = "SELECT uuid FROM %s WHERE " % (
         Constants.DBConstants.IceTables.NEXT_STEP) + "engagement_id=" +\
         "'%s' AND engagement_stage='%s' ORDER BY position;" % (
         engagement_uuid, engagement_stage)
     return DBGeneral.select_query(query, "list", 0)