Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Commit

Permalink
tests also added
Browse files Browse the repository at this point in the history
description field tests added

list indexed

str removed and create_event function changed

save issues solved

vola api updated with description

UI tests for description added
  • Loading branch information
anjali-dhanuka committed Aug 1, 2018
1 parent e703526 commit 4419e21
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 10 deletions.
6 changes: 4 additions & 2 deletions vms/event/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions vms/event/tests/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion vms/event/tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']
Expand Down
1 change: 1 addition & 0 deletions vms/event/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions vms/pom/locators/eventsPageLocators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions vms/pom/pages/eventsPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
7 changes: 5 additions & 2 deletions vms/shift/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 4419e21

Please sign in to comment.