diff --git a/vms/event/tests/test_api.py b/vms/event/tests/test_api.py index f4010e1..d2e11e6 100644 --- a/vms/event/tests/test_api.py +++ b/vms/event/tests/test_api.py @@ -16,7 +16,7 @@ class ApiForVolaViewTestCase(APITestCase, TestCase): """ def setUp(self): - event = ['event', '2015-02-05', '2015-05-05'] + event = ['event', '2015-02-05', '2015-05-05', 'event-description'] self.event_1 = create_event_with_details(event) self.event_1.city = 'city' self.event_1.state = 'state' @@ -27,13 +27,14 @@ def setUp(self): self.expected_result_one = {'event_name': 'event', 'start_date': '2015-02-05', 'end_date': '2015-05-05', + 'description': 'event-description', 'address': 'address', 'city': 'city', 'state': 'state', 'country': 'country', 'venue': 'venue'} - event = ['eventq', '2050-02-05', '2050-05-05'] + event = ['eventq', '2050-02-05', '2050-05-05', 'eventq-description'] self.event_2 = create_event_with_details(event) self.event_2.city = 'cityq' self.event_2.state = 'stateq' @@ -44,6 +45,7 @@ def setUp(self): self.expected_result_two = {'event_name': 'eventq', 'start_date': '2050-02-05', 'end_date': '2050-05-05', + 'description': 'eventq-description', 'address': 'addressq', 'city': 'cityq', 'state': 'stateq', diff --git a/vms/event/tests/test_event.py b/vms/event/tests/test_event.py index a7de65f..863f5f1 100644 --- a/vms/event/tests/test_event.py +++ b/vms/event/tests/test_event.py @@ -78,8 +78,8 @@ def test_event_details_view(self): self.assertEqual(event_details_page.get_event_end_date(), 'June 19, 2050') def test_event_detail_page(self): - # Navgate to event view - created_event = EventDetails.register_valid_event() + # Navigate to event view + created_event = create_event_with_details(['event', '2050-06-11', '2050-06-19', 'event-description']) event_details_page = self.event_details_page event_details_page.live_server_url = self.live_server_url event_details_page.go_to_events_page() @@ -88,7 +88,7 @@ def test_event_detail_page(self): self.assertEqual(event_details_page.get_event_name(), created_event.name) self.assertEqual(event_details_page.get_event_start_date(), 'June 11, 2050') self.assertEqual(event_details_page.get_event_end_date(), 'June 19, 2050') - + self.assertEqual(event_details_page.get_event_description(), 'event-description') def test_valid_event_create(self): created_event = EventDetails.register_valid_event() diff --git a/vms/event/tests/test_model.py b/vms/event/tests/test_model.py index 92e7c2b..21d1bf6 100644 --- a/vms/event/tests/test_model.py +++ b/vms/event/tests/test_model.py @@ -26,7 +26,7 @@ def create_event(): return created_event def test_valid_model_create(self): - event = ['event-name', '2050-05-24', '2050-05-28'] + event = ['event-name', '2050-05-24', '2050-05-28', 'event-description'] create_event_with_details(event) # Check database for instance creation @@ -37,6 +37,7 @@ def test_valid_model_create(self): self.assertEqual(event_in_db.name, event[0]) self.assertEqual(str(event_in_db.start_date), event[1]) self.assertEqual(str(event_in_db.end_date), event[2]) + self.assertEqual(event_in_db.description, event[3]) def test_invalid_model_create(self): event = ['event~name', '2050-05-21', '2050-05-24'] diff --git a/vms/event/views.py b/vms/event/views.py index 0557e7f..f5ef7bc 100644 --- a/vms/event/views.py +++ b/vms/event/views.py @@ -232,6 +232,7 @@ def return_event_data(self, events): event_data['event_name'] = event.name event_data['start_date'] = event.start_date event_data['end_date'] = event.end_date + event_data['description'] = event.description event_data['address'] = event.address event_data['city'] = event.city event_data['state'] = event.state diff --git a/vms/pom/locators/eventsPageLocators.py b/vms/pom/locators/eventsPageLocators.py index 9c11584..9815ca6 100644 --- a/vms/pom/locators/eventsPageLocators.py +++ b/vms/pom/locators/eventsPageLocators.py @@ -53,8 +53,8 @@ class EventsPageLocators(object): ORG_NAME = '//input[@name = "name"]' EVENT_NAME_ERROR = "//form//div[1]/div/p/strong" - EVENT_START_DATE_ERROR = "//form//div[2]/div/p/strong" - EVENT_END_DATE_ERROR = "//form//div[3]/div/p/strong" + EVENT_START_DATE_ERROR = "//form//div[3]/div/p/strong" + EVENT_END_DATE_ERROR = "//form//div[4]/div/p/strong" JOB_NAME_ERROR = "//form//div[3]/div/p/strong" JOB_START_DATE_ERROR = "//form//div[5]/div/p/strong" JOB_END_DATE_ERROR = "//form//div[6]/div/p/strong" diff --git a/vms/pom/pages/eventsPage.py b/vms/pom/pages/eventsPage.py index f6709a5..b481e69 100644 --- a/vms/pom/pages/eventsPage.py +++ b/vms/pom/pages/eventsPage.py @@ -96,6 +96,9 @@ def go_to_create_event_page(self): def go_to_details_event_page(self): self.element_by_xpath(self.elements.VIEW_EVENT).click() + def get_event_description(self): + return self.element_by_xpath('//div[@class="panel-body"]').text + def go_to_edit_event_page(self): self.element_by_xpath(self.elements.EDIT_EVENT).click() diff --git a/vms/shift/utils.py b/vms/shift/utils.py index 3c52b2b..7a16c04 100644 --- a/vms/shift/utils.py +++ b/vms/shift/utils.py @@ -40,8 +40,11 @@ def create_edit_request_with_details(start_time, end_time, logged_shift): def create_event_with_details(event): """ Creates and returns event with passed name and dates - """ - e1 = Event(name=event[0], start_date=event[1], end_date=event[2]) + """ + if len(event) == 4: + e1 = Event(name=event[0], start_date=event[1], end_date=event[2], description=event[3]) + else: + e1 = Event(name=event[0], start_date=event[1], end_date=event[2]) e1.save() return e1