예제 #1
0
 def test_check_report_volunteer(self):
     self.report_page.go_to_admin_report()
     country = create_country()
     state = create_state()
     city = create_city()
     credentials = {
         'username': '******',
         'first_name': 'VOLUNTEER-FIRST-NAME',
         'last_name': 'volunteer-last-name',
         'address': 'volunteer-address',
         'city': city,
         'state': state,
         'country': country,
         'phone_number': '9999999999',
         'email': '*****@*****.**'
     }
     org_name = 'volunteer-organization'
     org_obj = create_organization_with_details(org_name)
     vol = create_volunteer_with_details(credentials, org_obj)
     register_past_event_utility()
     register_past_job_utility()
     shift = register_past_shift_utility()
     start = datetime.time(hour=10, minute=0)
     end = datetime.time(hour=11, minute=0)
     logged_shift = log_hours_with_details(vol, shift, start, end)
     create_report_with_details(vol, logged_shift)
     report_page = self.report_page
     report_page.get_page(self.live_server_url,
                          PageUrls.administrator_report_page)
     self.assertEqual(report_page.get_volunteer_name(),
                      'VOLUNTEER-FIRST-NAME volunteer-last-name')
예제 #2
0
파일: test_report.py 프로젝트: systers/vms
 def test_check_report_hours(self):
     self.report_page.go_to_admin_report()
     vol = create_volunteer()
     register_past_event_utility()
     register_past_job_utility()
     shift = register_past_shift_utility()
     start=datetime.time(hour=10, minute=0)
     end=datetime.time(hour=11, minute=0)
     logged_shift = log_hours_with_details(vol, shift, start, end)
     create_report_with_details(vol, logged_shift)
     report_page = self.report_page
     report_page.get_page(self.live_server_url, PageUrls.administrator_report_page)
     self.assertEqual(report_page.get_hours(), '1.00')
예제 #3
0
 def test_check_report_hours(self):
     self.report_page.go_to_admin_report()
     vol = create_volunteer()
     register_past_event_utility()
     register_past_job_utility()
     shift = register_past_shift_utility()
     start = datetime.time(hour=10, minute=0)
     end = datetime.time(hour=11, minute=0)
     logged_shift = log_hours_with_details(vol, shift, start, end)
     create_report_with_details(vol, logged_shift)
     report_page = self.report_page
     report_page.get_page(self.live_server_url,
                          PageUrls.administrator_report_page)
     self.assertEqual(report_page.get_hours(), '1.00')
예제 #4
0
    def test_check_volunteer_reports(self):
        search_page = self.search_page
        search_page.live_server_url = self.live_server_url
        credentials_1 = [
            'volunteer-username', 'volunteer-first-name',
            'VOLUNTEER-LAST-NAME', 'volunteer-address', 'volunteer-city',
            'volunteer-state', 'volunteer-country', '9999999999',
            '*****@*****.**'
        ]
        org_name = 'volunteer-organization'
        org_obj = create_organization_with_details(org_name)
        vol = create_volunteer_with_details(credentials_1, org_obj)

        register_past_event_utility()
        register_past_job_utility()
        shift = register_past_shift_utility()
        start=datetime.time(hour=10, minute=0)
        end=datetime.time(hour=11, minute=0)
        logged_shift = log_hours_with_details(vol, shift, start, end)
        report = create_report_with_details(vol, logged_shift)
        report.confirm_status = 1
        report.save()

        search_page.navigate_to_volunteer_search_page()
        search_page.submit_form()

        self.assertEqual(search_page.element_by_xpath(self.elements.VIEW_REPORTS).text, 'View')
        search_page.element_by_xpath(self.elements.VIEW_REPORTS + '//a').click()
        self.assertEqual(search_page.remove_i18n(self.driver.current_url), self.live_server_url + PageUrls.volunteer_history_page + str(vol.id))
        self.verify_report_details('1')
예제 #5
0
파일: test_report.py 프로젝트: systers/vms
 def test_reject_report(self):
     self.report_page.go_to_admin_report()
     vol = create_volunteer()
     register_past_event_utility()
     register_past_job_utility()
     shift = register_past_shift_utility()
     start=datetime.time(hour=10, minute=0)
     end=datetime.time(hour=11, minute=0)
     logged_shift = log_hours_with_details(vol, shift, start, end)
     create_report_with_details(vol, logged_shift)
     report_page = self.report_page
     report_page.get_page(self.live_server_url, PageUrls.administrator_report_page)
     self.assertEqual(report_page.get_rejection_context(), 'Reject')
     report_page.reject_report()
     with self.assertRaises(NoSuchElementException):
         report_page.get_report()
예제 #6
0
 def test_reject_report(self):
     self.report_page.go_to_admin_report()
     vol = create_volunteer()
     register_past_event_utility()
     register_past_job_utility()
     shift = register_past_shift_utility()
     start = datetime.time(hour=10, minute=0)
     end = datetime.time(hour=11, minute=0)
     logged_shift = log_hours_with_details(vol, shift, start, end)
     create_report_with_details(vol, logged_shift)
     report_page = self.report_page
     report_page.get_page(self.live_server_url,
                          PageUrls.administrator_report_page)
     self.assertEqual(report_page.get_rejection_context(), 'Reject')
     report_page.reject_report()
     with self.assertRaises(NoSuchElementException):
         report_page.get_report()
예제 #7
0
    def test_get_report_by_id(self):
        start = datetime.time(hour=10, minute=0)
        end = datetime.time(hour=12, minute=0)
        logged_shift_1 = log_hours_with_details(self.v1, self.s1, start, end)
        r1 = create_report_with_details(self.v1, logged_shift_1)

        logged_shift_2 = log_hours_with_details(self.v2, self.s2, start, end)
        r2 = create_report_with_details(self.v2, logged_shift_2)

        self.assertIsNotNone(get_report_by_id(r1.id))
        self.assertIsNotNone(get_report_by_id(r2.id))

        self.assertEqual(get_report_by_id(r1.id), r1)
        self.assertEqual(get_report_by_id(r2.id), r2)

        # test non-existant cases
        self.assertIsNone(get_report_by_id(100))
        self.assertIsNone(get_report_by_id(200))
예제 #8
0
    def test_get_report_by_id(self):
        start = datetime.time(hour=10, minute=0)
        end = datetime.time(hour=12, minute=0)
        logged_shift_1 = log_hours_with_details(self.v1, self.s1, start, end)
        r1 = create_report_with_details(self.v1, logged_shift_1)

        logged_shift_2 = log_hours_with_details(self.v2, self.s2, start, end)
        r2 = create_report_with_details(self.v2, logged_shift_2)

        self.assertIsNotNone(get_report_by_id(r1.id))
        self.assertIsNotNone(get_report_by_id(r2.id))

        self.assertEqual(get_report_by_id(r1.id), r1)
        self.assertEqual(get_report_by_id(r2.id), r2)

        # test non-existant cases
        self.assertIsNone(get_report_by_id(100))
        self.assertIsNone(get_report_by_id(200))
예제 #9
0
파일: test_report.py 프로젝트: systers/vms
 def test_check_report_volunteer(self):
     self.report_page.go_to_admin_report()
     credentials = [
         'volunteer-username', 'VOLUNTEER-FIRST-NAME',
         'volunteer-last-name', 'volunteer-address', 'volunteer-city',
         'volunteer-state', 'volunteer-country', '9999999999',
         '*****@*****.**'
     ]
     org_name = 'volunteer-organization'
     org_obj = create_organization_with_details(org_name)
     vol = create_volunteer_with_details(credentials, org_obj)
     register_past_event_utility()
     register_past_job_utility()
     shift = register_past_shift_utility()
     start=datetime.time(hour=10, minute=0)
     end=datetime.time(hour=11, minute=0)
     logged_shift = log_hours_with_details(vol, shift, start, end)
     create_report_with_details(vol, logged_shift)
     report_page = self.report_page
     report_page.get_page(self.live_server_url, PageUrls.administrator_report_page)
     self.assertEqual(report_page.get_volunteer_name(), 'VOLUNTEER-FIRST-NAME volunteer-last-name')
예제 #10
0
 def test_email_on_reject_report(self):
     self.report_page.go_to_admin_report()
     vol = create_volunteer()
     register_past_event_utility()
     register_past_job_utility()
     shift = register_past_shift_utility()
     start = datetime.time(hour=10, minute=0)
     end = datetime.time(hour=11, minute=0)
     logged_shift = log_hours_with_details(vol, shift, start, end)
     create_report_with_details(vol, logged_shift)
     report_page = self.report_page
     report_page.get_page(self.live_server_url,
                          PageUrls.administrator_report_page)
     self.assertEqual(report_page.get_rejection_context(), 'Reject')
     report_page.reject_report()
     mail.outbox = []
     mail.send_mail("Report Rejected", "message", "*****@*****.**",
                    [vol.email])
     self.assertEqual(len(mail.outbox), 1)
     msg = mail.outbox[0]
     self.assertEqual(msg.subject, 'Report Rejected')
     self.assertEqual(msg.to, ['*****@*****.**'])
예제 #11
0
 def test_email_on_report_approval(self):
     vol = create_volunteer()
     register_past_event_utility()
     register_past_job_utility()
     shift = register_past_shift_utility()
     start = datetime.time(hour=10, minute=0)
     end = datetime.time(hour=11, minute=0)
     logged_shift = log_hours_with_details(vol, shift, start, end)
     report = create_report_with_details(vol, logged_shift)
     mail.send_mail("Report Approved", "message", "*****@*****.**",
                    [vol.email])
     self.assertEqual(len(mail.outbox), 1)
     msg = mail.outbox[0]
     self.assertEqual(msg.subject, 'Report Approved')
     self.assertEqual(msg.to, ['*****@*****.**'])
     response = self.client.get('/administrator/report/approve/%s' %
                                report.id)
     self.assertEqual(response.status_code, 302)
예제 #12
0
 def create_report(volunteer, shift):
     start = datetime.time(hour=9, minute=0)
     end = datetime.time(hour=12, minute=0)
     logged_shift = log_hours_with_details(volunteer, shift, start, end)
     return create_report_with_details(volunteer, logged_shift)