From 115af08e7ce529e2e9298d93a98aacf77bb007af Mon Sep 17 00:00:00 2001 From: Nwokolo Godwin Date: Sun, 27 Dec 2020 12:08:28 +0100 Subject: [PATCH] Remove Functional Test For Displaying Year Of Future Event Since the current CI at the main branch does not support selenium [web driver] operations, the functional test which depends on selenium to run has been removed. --- .gitignore | 1 + dev-requirements.txt | 2 + events/tests/test_events_functional_test.py | 62 --------------------- 3 files changed, 3 insertions(+), 62 deletions(-) delete mode 100644 events/tests/test_events_functional_test.py diff --git a/.gitignore b/.gitignore index 60836490f..6896ca04a 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ __pycache__ .env .DS_Store .envrc +*.db diff --git a/dev-requirements.txt b/dev-requirements.txt index 182beea18..f51e64ac2 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -6,6 +6,8 @@ factory-boy==3.1.0 Faker==0.8.1 tblib==1.7.0 responses==0.13.3 +tblib==1.3.2 +responses==0.10.5 # Extra stuff required for local dev diff --git a/events/tests/test_events_functional_test.py b/events/tests/test_events_functional_test.py deleted file mode 100644 index b6164409b..000000000 --- a/events/tests/test_events_functional_test.py +++ /dev/null @@ -1,62 +0,0 @@ -import datetime - -from django.contrib.auth import get_user_model -from django.test import LiveServerTestCase -from django.utils import timezone -from selenium.common.exceptions import WebDriverException -from selenium.webdriver import Chrome - -from ..models import Event, OccurringRule, Calendar - - -class EventsPageFunctionalTests(LiveServerTestCase): - @classmethod - def setUpClass(cls): - cls.now = timezone.now() - cls.user = get_user_model().objects.create_user(username='username', password='password') - cls.calendar = Calendar.objects.create(creator=cls.user, slug="test-calendar-2") - cls.event_future_start_following_year = Event.objects.create(title='Event Starts Following Year', - creator=cls.user, calendar=cls.calendar) - cls.event_future_end_following_year = Event.objects.create(title='Event Ends Following Year', - creator=cls.user, calendar=cls.calendar) - recurring_time_dtstart = cls.now + datetime.timedelta(days=3) - recurring_time_dtend = recurring_time_dtstart + datetime.timedelta(days=5) - - cls.rule_future_start_year = OccurringRule.objects.create( - event=cls.event_future_start_following_year, - dt_start=recurring_time_dtstart + datetime.timedelta(weeks=52), - dt_end=recurring_time_dtstart + datetime.timedelta(weeks=53), - ) - cls.rule_future_end_year = OccurringRule.objects.create( - event=cls.event_future_end_following_year, - dt_start=recurring_time_dtstart, - dt_end=recurring_time_dtend + datetime.timedelta(weeks=52) - ) - super(EventsPageFunctionalTests, cls).setUpClass() - - def setUp(self) -> None: - try: - self.browser = Chrome() - self.browser.implicitly_wait(5) - except WebDriverException: # GitHub Actions Django CI - from selenium import webdriver - self.browser = webdriver.FirefoxOptions() - self.browser.headless = True - webdriver.Firefox(options=self.browser) - - def tearDown(self) -> None: - super().tearDown() - try: - self.browser.quit() - except Exception: - pass - - def test_event_starting_and_ending_future_year_displays_year(self): - event = self.event_future_start_following_year - self.browser.get(self.live_server_url + '/events/') - future_event_span_value = self.browser.find_element_by_id("start-"+str(event.id)) - self.assertIn(str(event.next_time.dt_start.year), future_event_span_value.text) - - event_2 = Event.objects.get(title="Event Ends Following Year") - future_event_span_value = self.browser.find_element_by_id("end-"+str(event_2.id)) - self.assertIn(str(event_2.next_time.dt_end.year), future_event_span_value.text)