@@ -0,0 +1,2781 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom datetime import date, timedelta%0Atry:%0A    from unittest.mock import patch%0Aexcept ImportError:%0A    from mock import patch%0A%0Afrom nowait.tests.factories import UserF, BookingType30F, RootNowaitPageF%0Afrom .base import FunctionalTest%0A%0A%0Aclass UserCreateBookingTest(FunctionalTest):%0A    def setUp(self):%0A        super(UserCreateBookingTest, self).setUp()%0A        self.user = UserF()%0A        self.root = RootNowaitPageF()%0A        # self.create_pre_authenticated_session(self.admin)%0A        # 2013-9-9 is a Monday%0A        start = date(2013, 9, 9)%0A        self.today = start - timedelta(days=2)%0A        self.start_dates = %5Bstart, date(2013, 10, 7), date(2013, 11, 4)%5D%0A        self.bookingtype = BookingType30F()%0A        self.bookingtype.get_or_create_link()%0A        self.bookingtype.dailyslottimepattern_set.create(%0A            day=0, start_time='9:00', end_time='13:00')%0A        for start_date in self.start_dates:%0A            self.bookingtype.slottimesgeneration_set.create(%0A                start_date='%7B0:%25Y-%25m-%25d%7D'.format(start_date),%0A                end_date='%7B0:%25Y-%25m-%25d%7D'.format(start_date + timedelta(days=7)))%0A        for dstp in self.bookingtype.slottimesgeneration_set.all():%0A            dstp.create_slot_times()%0A%0A    @patch('nowait.views.timezone.now')%0A    def test_user_choose_slottime_make_login_and_create_booking(%0A            self, mock_now):%0A        mock_now.return_value = self.today%0A        # user go to home page %22/%22%0A        self.browser.get(self.get_url('/'))%0A        # user click on link of root nowait page from left panel tree%0A        left_panel_tree = self.get_left_panel_tree()%0A        left_panel_tree.find_element_by_link_text(self.root.title).click()%0A        # user click on link of choosen booking type from left panel tree%0A        left_panel_tree = self.get_left_panel_tree()%0A        left_panel_tree.find_element_by_link_text(%0A            self.bookingtype.title).click()%0A        # user click on link %22Make your reservation%22%0A        self.browser.find_element_by_partial_link_text(%0A            'Make your reservation').click()%0A        slottime_selected = self.browser.find_elements_by_css_selector(%0A            '.tab-content .active a.thumbnail')%5B0%5D%0A        slottime_selected_id = slottime_selected.get_attribute('id')%0A        slottime_selected.click()%0A        # user is redirected to login page and now insert his credentials%0A        self.browser.find_element_by_id('id_username').send_keys(%0A            self.user.username)%0A        self.browser.find_element_by_id('id_password').send_keys(%0A            self.user.username)%0A        self.browser.find_element_by_css_selector(%0A            '.form-actions input').click()%0A        print(slottime_selected_id)%0A%0A        import ipdb; ipdb.set_trace()%0A%0A%0A

add simple booking creation functional test