当前位置: 首页>>代码示例>>Python>>正文


Python utils.create_job_with_details函数代码示例

本文整理汇总了Python中shift.utils.create_job_with_details函数的典型用法代码示例。如果您正苦于以下问题:Python create_job_with_details函数的具体用法?Python create_job_with_details怎么用?Python create_job_with_details使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create_job_with_details函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_delete_event_with_associated_job

    def test_delete_event_with_associated_job(self):
        event = ['event-name', '2050-08-21', '2050-09-28']
        created_event = create_event_with_details(event)

        # create job
        job = ['job', '2050-08-21', '2050-08-21', '', created_event]
        create_job_with_details(job)

        self.settings.go_to_events_page()
        settings = self.settings
        settings.live_server_url = self.live_server_url

        # check event created
        settings.navigate_to_event_list_view()
        self.assertEqual(settings.get_event_name(), created_event.name)

        # delete event
        self.delete_event_from_list()

        self.assertNotEqual(settings.get_danger_message(), None)
        self.assertEqual(settings.get_template_error_message(),
                         'You cannot delete an event that a job is currently associated with.')

        # check event NOT deleted
        settings.navigate_to_event_list_view()
        self.assertEqual(settings.get_event_name(), 'event-name')
开发者ID:systers,项目名称:vms,代码行数:26,代码来源:test_settings.py

示例2: setUpModule

def setUpModule():
    """
    - Creates objects which can be reused by multiple test classes
    - Creates shifts with limited slots and with multiple slots for use
    """

    global e1
    global j1, j2
    global s1, s2, s3

    event_1 = ["Open Source Event", "2012-9-1", "2012-11-23"]
    e1 = create_event_with_details(event_1)

    job_1 = [
        "Software Developer", "2012-10-22", "2012-10-30", "A software job", e1
    ]
    job_2 = [
        "Systems Administrator", "2012-9-1", "2012-10-26",
        "A systems administrator job", e1
    ]
    j1 = create_job_with_details(job_1)
    j2 = create_job_with_details(job_2)

    shift_1 = ["2012-10-28", "9:00", "15:00", 1, j1]
    shift_2 = ["2012-10-25", "10:00", "16:00", 2, j1]
    shift_3 = ["2012-10-22", "10:00", "16:00", 4, j2]

    s1 = create_shift_with_details(shift_1)
    s2 = create_shift_with_details(shift_2)
    s3 = create_shift_with_details(shift_3)
开发者ID:systers,项目名称:vms,代码行数:30,代码来源:test_services.py

示例3: test_edit_event_with_invalid_job_date

    def test_edit_event_with_invalid_job_date(self):
        event = ['event-name', '2050-08-21', '2050-09-28']
        created_event = create_event_with_details(event)

        # Create Job
        job = ['job', '2050-08-21', '2050-08-21', '', created_event]
        create_job_with_details(job)

        self.settings.go_to_events_page()
        settings = self.settings
        settings.live_server_url = self.live_server_url
        settings.navigate_to_event_list_view()

        self.assertEqual(settings.get_event_name(), created_event.name)
        settings.go_to_edit_event_page()

        # Edit event such that job is no longer in the new date range
        new_event = ['new-event-name', '2017-08-30', '2017-09-21']
        settings.fill_event_form(new_event)

        # check event not edited and error message displayed
        self.assertNotEqual(self.driver.current_url, self.live_server_url + settings.event_list_page)
        self.assertEqual(settings.element_by_xpath(self.elements.TEMPLATE_ERROR_MESSAGE).text,
                         'You cannot edit this event as the following associated job no longer '
                         'lies within the new date range :')
开发者ID:systers,项目名称:vms,代码行数:25,代码来源:test_settings.py

示例4: test_event_job_field

    def test_event_job_field(self):
        """
        Test search results for event job field
        """
        search_page = self.search_page
        search_page.live_server_url = self.live_server_url

        credentials_1 = ['event-name', '2015-01-01', '2015-03-01']

        event_1 = create_event_with_details(credentials_1)

        credentials_2 = [
            'event-nameq', '2015-02-01', '2015-04-01']
        event_2 = create_event_with_details(credentials_2)

        expected_result_one = ['event-name', 'Jan.', '1,', '2015', 'March', '1,', '2015', 'Details', 'Edit', 'Delete']
        expected_result_two = ['event-nameq', 'Feb.', '1,', '2015', 'April', '1,', '2015', 'Details', 'Edit', 'Delete']

        # job_1 for event_1, job_2 for event_2
        job = ['job-name', '2015-02-01', '2015-02-15', 'job-description', event_1]
        job_1 = create_job_with_details(job)

        job = ['job-nameq', '2015-02-02', '2015-02-15', 'job-descriptionq', event_2]
        job_2 = create_job_with_details(job)

        # search job_1 and job_2
        search_page.navigate_to_event_search_page()
        search_page.search_job_field("job-name")
        search_results = search_page.get_search_results()
        result = search_page.get_results_list(search_results)
        self.assertEqual(len(result), 2)
        self.assertTrue(expected_result_one in result)
        self.assertTrue(expected_result_two in result)
开发者ID:systers,项目名称:vms,代码行数:33,代码来源:test_searchEvent.py

示例5: test_null_values_in_edit_job

    def test_null_values_in_edit_job(self):
        # Register Event
        event = ['event-name', '2050-05-24', '2050-05-28']
        created_event = create_event_with_details(event)
        self.settings.go_to_events_page()
        settings = self.settings

        # Create Job with not-null values
        job = ['job', '2050-05-24', '2050-05-28', '', created_event]
        create_job_with_details(job)

        # Go to Edit job page
        settings.live_server_url = self.live_server_url
        settings.navigate_to_job_list_view()
        settings.go_to_edit_job_page()

        # Edit job with null values
        settings.fill_job_form([created_event.id, '', '', '', ''])

        # Checks:
        # Job not edited
        # Error messages appear
        self.assertNotEqual(self.driver.current_url, self.live_server_url + settings.job_list_page)
        self.assertEqual(len(settings.get_help_blocks()), 3)
        self.assertEqual(settings.get_job_name_error(), 'This field is required.')
        self.assertEqual(settings.get_job_start_date_error(), 'This field is required.')
        self.assertEqual(settings.get_job_end_date_error(), 'This field is required.')
开发者ID:systers,项目名称:vms,代码行数:27,代码来源:test_formFields.py

示例6: test_null_values_in_create_shift

    def test_null_values_in_create_shift(self):
        # Register Event
        event = ['event-name', '2050-05-24', '2050-05-28']
        created_event = create_event_with_details(event)
        self.settings.go_to_events_page()
        settings = self.settings

        # Create Job with not-null values
        job = ['job', '2050-05-24', '2050-05-28', '', created_event]
        create_job_with_details(job)

        settings.live_server_url = self.live_server_url
        settings.navigate_to_shift_list_view()
        settings.go_to_create_shift_page()

        # Create Shift
        shift = ['', '', '', '']
        settings.fill_shift_form(shift)

        # Checks:
        # Shift not created
        # Error messages appear
        self.assertEqual(len(settings.get_help_blocks()), 4)

        self.assertEqual(settings.get_shift_date_error(), 'This field is required.')
        self.assertEqual(settings.get_shift_start_time_error(), 'This field is required.')
        self.assertEqual(settings.get_shift_end_time_error(), 'This field is required.')
        self.assertEqual(settings.get_shift_max_volunteer_error(), 'This field is required.')
开发者ID:systers,项目名称:vms,代码行数:28,代码来源:test_formFields.py

示例7: test_edit_job_with_invalid_event_date

    def test_edit_job_with_invalid_event_date(self):
        # register event first to create job
        event = ['event-name', '2050-08-21', '2050-09-28']
        created_event = create_event_with_details(event)

        # create job
        job = ['job', '2050-08-21', '2050-08-21', '', created_event]
        create_job_with_details(job)

        invalid_job_one = ['event-name', 'changed job name', 'job description', '2050-05-03', '2050-11-09']

        self.settings.go_to_events_page()
        settings = self.settings
        settings.live_server_url = self.live_server_url

        # edit job with start date outside event start date
        settings.navigate_to_job_list_view()
        settings.go_to_edit_job_page()
        settings.fill_job_form(invalid_job_one)

        # check job not edited and proper error message displayed
        self.assertNotEqual(self.driver.current_url, self.live_server_url + settings.job_list_page)
        self.assertEqual(settings.get_warning_context(), 'Job dates should lie within Event dates')

        invalid_job_two = ['event-name', 'changed job name', 'job description', '2050-09-14', '2050-12-31']
        settings.navigate_to_job_list_view()
        settings.go_to_edit_job_page()
        settings.fill_job_form(invalid_job_two)

        # check job not edited and proper error message displayed
        self.assertNotEqual(self.driver.current_url, self.live_server_url + settings.job_list_page)
        self.assertEqual(settings.get_warning_context(), 'Job dates should lie within Event dates')
开发者ID:systers,项目名称:vms,代码行数:32,代码来源:test_settings.py

示例8: setUpModule

def setUpModule():
    """
    - Creates objects which can be reused by multiple test classes
    - Creates jobs that can be used later for shift creation
    """

    global e1, e2, j1, j2, j3
    event_1 = ["Software Conference", "2012-10-3", "2012-11-25"]
    event_2 = ["Django Conference", "2012-10-13", "2012-11-25"]
    e1 = create_event_with_details(event_1)
    e2 = create_event_with_details(event_2)

    job_1 = [
        "Software Developer", "2012-10-22", "2012-10-25", "A software job", e1
    ]
    job_2 = [
        "Systems Administrator", "2012-10-8", "2012-10-16",
        "A systems administrator job", e1
    ]
    job_3 = [
        "Project Manager", "2012-11-2", "2012-11-12", "A management job", e1
    ]

    j1 = create_job_with_details(job_1)
    j2 = create_job_with_details(job_2)
    j3 = create_job_with_details(job_3)
开发者ID:systers,项目名称:vms,代码行数:26,代码来源:test_services.py

示例9: test_intersection_of_all_fields

    def test_intersection_of_all_fields(self):
        """
        Test search results for different combinations of event name, start date, end date, city, state, country and job
        """
        search_page = self.search_page
        search_page.live_server_url = self.live_server_url

        credentials_1 = ['event-name', '2015-01-01', '2015-03-01']

        event_1 = create_event_with_details(credentials_1)
        event_1.country = 'event-country'
        event_1.state = 'event-state'
        event_1.city = 'event-city'
        event_1.save()
        job = ['job', '2015-02-01', '2015-02-15', 'descriptionq', event_1]
        job_1 = create_job_with_details(job)


        credentials_2 = [
            'event-nameq', '2015-02-01', '2015-04-01']
        event_2 = create_event_with_details(credentials_2)
        event_2.country = 'event-countryq'
        event_2.state = 'event-stateq'
        event_2.city = 'event-cityq'
        event_2.save()
        job = ['jobq', '2015-02-02', '2015-02-15', 'job-description', event_2]
        job_2 = create_job_with_details(job)


        expected_result_one = ['event-name', 'Jan.', '1,', '2015', 'March', '1,', '2015', 'Details', 'Edit', 'Delete']
        expected_result_two = ['event-nameq', 'Feb.', '1,', '2015', 'April', '1,', '2015', 'Details', 'Edit', 'Delete']
        search_page.navigate_to_event_search_page()

        search_page.search_name_field('event')
        search_page.search_start_date_field('2015-01-01')
        search_page.search_end_date_field('2015-04-01')
        search_page.search_state_field('event')
        search_page.search_country_field('event')
        search_page.search_job_field('job')
        search_page.submit_form()
        search_results = search_page.get_search_results()
        result = search_page.get_results_list(search_results)
        self.assertTrue(expected_result_one in result)
        self.assertTrue(expected_result_two in result)

        search_page.search_name_field('event')
        search_page.search_country_field('wrong-country')
        search_page.search_job_field(job_1.id)
        search_page.submit_form()
        self.assertRaisesRegexp(NoSuchElementException,
                                'Unable to locate element: //table//tbody',
                                search_page.get_search_results)

        search_page.search_state_field('event')
        search_page.search_city_field('wrong-city')
        search_page.submit_form()
        self.assertRaisesRegexp(NoSuchElementException,
                                'Unable to locate element: //table//tbody',
                                search_page.get_search_results)
开发者ID:systers,项目名称:vms,代码行数:59,代码来源:test_searchEvent.py

示例10: setup_test_data

    def setup_test_data(cls):
        event_1 = ["Software Conference","2012-10-3","2012-10-24"]
        cls.e1 = create_event_with_details(event_1)

        job_1 = ["Software Developer","2012-10-22","2012-10-23","A software job",e1]
        job_2 = ["Systems Administrator","2012-10-8","2012-10-16","A systems administrator job",e1]

        cls.j1 = create_job_with_details(job_1)
        cls.j2 = create_job_with_details(job_2)

        shift_1 = ["2012-10-23","1:00","3:00",1,cls.j1]
        cls.s1 = create_shift_with_details(shift_1)
开发者ID:systers,项目名称:automated-testing,代码行数:12,代码来源:test_services.py

示例11: setUpModule

def setUpModule():
    """
    Creates events, jobs and shifts which can be reused by multiple test classes
    """

    global e1, e2, e3, e4, e5
    global j1, j2, j3, j4, j5
    global s1, s2, s3, s4

    event_1 = ["Open Source Event", "2012-10-22", "2012-10-23"]
    event_2 = ["Python Event", "2013-11-12", "2013-11-13"]
    event_3 = ["Django Event", "2015-07-02", "2015-07-03"]
    event_4 = ["Systers Event", "2015-07-25", "2015-08-08"]
    event_5 = ["Anita Borg Event", "2015-07-07", "2015-07-08"]

    e1 = create_event_with_details(event_1)
    e2 = create_event_with_details(event_2)
    e3 = create_event_with_details(event_3)
    e4 = create_event_with_details(event_4)
    e5 = create_event_with_details(event_5)

    job_1 = [
        "Software Developer", "2012-10-22", "2012-10-23", "A software job", e1
    ]
    job_2 = [
        "Systems Administrator", "2013-11-12", "2013-11-13",
        "A systems administrator job", e2
    ]
    job_3 = [
        "Backend Dev", "2012-10-8", "2012-10-16", "A java developer job", e4
    ]
    job_4 = ["Instructor", "2012-10-22", "2012-10-23", "", e4]
    job_5 = ["Instructor", "2012-10-22", "2012-10-23", "", e3]

    j1 = create_job_with_details(job_1)
    j2 = create_job_with_details(job_2)
    j3 = create_job_with_details(job_3)
    j4 = create_job_with_details(job_4)
    j5 = create_job_with_details(job_5)

    # shifts with limited, plenty and no slots
    shift_1 = ["2012-10-23", "9:00", "15:00", 1, j1]
    shift_2 = ["2012-10-23", "10:00", "16:00", 2, j1]
    shift_3 = ["2013-11-12", "12:00", "18:00", 4, j2]
    shift_4 = ["2013-10-23", "10:00", "18:00", 1, j4]

    s1 = create_shift_with_details(shift_1)
    s2 = create_shift_with_details(shift_2)
    s3 = create_shift_with_details(shift_3)
    s4 = create_shift_with_details(shift_4)
开发者ID:systers,项目名称:vms,代码行数:50,代码来源:test_services.py

示例12: test_create_shift_with_invalid_date

    def test_create_shift_with_invalid_date(self):
        # register event first to create job
        event = ['event-name', '2017-08-21', '2017-09-28']
        created_event = create_event_with_details(event)

        # create job
        job = ['job', '2017-08-21', '2017-08-30', '',created_event]
        created_job = create_job_with_details(job)

        settings = self.settings
        settings.live_server_url = self.live_server_url

        # create shift
        settings.navigate_to_shift_list_view()
        settings.go_to_create_shift_page()

        shift = ['06/30/2017', '14:00', '18:00', '5']
        settings.fill_shift_form(shift)

        # verify that shift was not created and error message displayed
        self.assertEqual(settings.get_warning_context(),
            'Shift date should lie within Job dates')

        # database check to ensure that shift was not created
        self.assertEqual(len(Shift.objects.all()), 0)
开发者ID:systers,项目名称:automated-testing,代码行数:25,代码来源:test_settings.py

示例13: test_create_shift

    def test_create_shift(self):
        # register event first to create job
        event = ['event-name', '2017-08-21', '2017-09-28']
        created_event = create_event_with_details(event)

        # create job
        job = ['job', '2017-08-21', '2017-08-30', '',created_event]
        created_job = create_job_with_details(job)

        settings = self.settings
        settings.live_server_url = self.live_server_url

        # create shift
        settings.navigate_to_shift_list_view()
        settings.go_to_create_shift_page()

        shift = ['08/30/2017', '09:00', '12:00', '10']
        settings.fill_shift_form(shift)

        # verify that shift was created
        self.assertNotEqual(settings.get_results(), None)
        with self.assertRaises(NoSuchElementException):
            settings.get_help_block()

        # database check to ensure that shift created with proper job
        self.assertEqual(len(Shift.objects.all()), 1)
        self.assertNotEqual(len(Shift.objects.filter(job=created_job)), 0)
开发者ID:systers,项目名称:automated-testing,代码行数:27,代码来源:test_settings.py

示例14: test_delete_job_with_associated_shifts

    def test_delete_job_with_associated_shifts(self):

        # register event first to create job
        event = ['event-name', '2017-08-21', '2017-09-28']
        created_event = create_event_with_details(event)

        # create job
        job = ['job', '2017-08-21', '2017-08-21', '',created_event]
        created_job = create_job_with_details(job)

        # create shift
        shift = ['2017-08-21', '09:00', '12:00', '10', created_job]
        created_shift = create_shift_with_details(shift)

        settings = self.settings
        settings.live_server_url = self.live_server_url

        # delete job
        settings.navigate_to_job_list_view()
        self.delete_job_from_list()

        self.assertNotEqual(settings.get_danger_message(), None)
        self.assertEqual(settings.get_template_error_message(),
            'You cannot delete a job that a shift is currently associated with.')

        # check job NOT deleted
        settings.navigate_to_job_list_view()
        self.assertEqual(settings.get_job_name(), 'job')

        # database check to ensure that job is not deleted
        self.assertEqual(len(Job.objects.all()), 1)
        self.assertNotEqual(len(Job.objects.filter(name = created_job.name)), 0)
开发者ID:systers,项目名称:automated-testing,代码行数:32,代码来源:test_settings.py

示例15: test_delete_job_without_associated_shift

    def test_delete_job_without_associated_shift(self):
        # register event first to create job
        event = ['event-name', '2017-08-21', '2017-09-28']
        created_event = create_event_with_details(event)

        # create job
        job = ['job', '2017-08-21', '2017-08-21', '',created_event]
        created_job = create_job_with_details(job)

        settings = self.settings
        settings.live_server_url = self.live_server_url
        settings.navigate_to_job_list_view()
        self.assertEqual(settings.get_job_name(), 'job')
        self.assertEqual(settings.get_job_event(), 'event-name')

        # delete job
        self.delete_job_from_list()

        # check event deleted
        self.assertEqual(self.driver.current_url,
                         self.live_server_url + settings.job_list_page)
        with self.assertRaises(NoSuchElementException):
            settings.get_results()

        # database check to ensure that job is deleted
        self.assertEqual(len(Job.objects.all()), 0)
开发者ID:systers,项目名称:automated-testing,代码行数:26,代码来源:test_settings.py


注:本文中的shift.utils.create_job_with_details函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。