diff --git a/requirements.txt b/requirements.txt index fc35b1dd5ec357eadfe2025d9369564437c5eb26..fa9f5fb96816092841bd88e5b03692bb1e7c5663 100644 --- a/requirements.txt +++ b/requirements.txt @@ -71,9 +71,8 @@ python-memcached # }}} # {{{ A task queue, used to execute long-running tasks -celery==4.1.0 -# https://github.com/celery/kombu/issues/870 -kombu==4.1.0 +celery==4.2.1 +kombu==4.2.2-post1 django-celery-results==1.0.1 # }}} diff --git a/tests/test_calendar.py b/tests/test_calendar.py index 7d65a6ddcc206c172569105cd9495b84663b486c..70cefc16669796e6ae2df3508c6cd612c7f47279 100644 --- a/tests/test_calendar.py +++ b/tests/test_calendar.py @@ -602,7 +602,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): self.addCleanup(factories.EventFactory.reset_sequence) - def get_course_calender_view(self, course_identifier=None): + def get_course_calendar_view(self, course_identifier=None): course_identifier = course_identifier or self.get_default_course_identifier() return self.c.get(self.get_course_calender_url(course_identifier)) @@ -616,12 +616,12 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): "course.utils.CoursePageContext.has_permission" ) as mock_has_pperm: mock_has_pperm.return_value = False - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() self.assertEqual(resp.status_code, 403) def test_neither_events_nor_event_file(self): self.mock_get_now_or_fake_time.return_value = self.default_faked_now - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() self.assertEqual(resp.status_code, 200) self.assertResponseContextEqual(resp, "events_json", '[]') self.assertResponseContextEqual(resp, "event_info_list", []) @@ -636,7 +636,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): kind=self.default_event_kind, course=self.course, time=self.default_event_time + timedelta(hours=1)) - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() self.assertEqual(resp.status_code, 200) events_json = json.loads(resp.context["events_json"]) @@ -664,7 +664,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): shown_in_calendar=False, time=self.default_event_time + timedelta(hours=1)) - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() self.assertEqual(resp.status_code, 200) events_json = json.loads(resp.context["events_json"]) @@ -681,7 +681,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): kind=self.default_event_kind, course=self.course, time=self.default_event_time, end_time=self.default_event_time + timedelta(hours=1)) - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() self.assertEqual(resp.status_code, 200) events_json = json.loads(resp.context["events_json"]) @@ -702,7 +702,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): self.course.end_date = (self.default_faked_now - timedelta(weeks=1)).date() self.course.save() - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() self.assertEqual(resp.status_code, 200) self.assertResponseContextEqual(resp, "events_json", '[]') @@ -715,7 +715,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): self.course.end_date = (self.default_faked_now + timedelta(weeks=1)).date() self.course.save() - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() self.assertEqual(resp.status_code, 200) self.assertResponseContextEqual(resp, "events_json", '[]') @@ -727,13 +727,15 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): # make sure it works self.switch_to_fake_commit_sha() - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() self.assertResponseContextEqual(resp, "events_json", '[]') self.assertResponseContextEqual(resp, "event_info_list", []) def test_events_file_with_events_test1(self): self.switch_to_fake_commit_sha() + self.mock_get_now_or_fake_time.return_value = ( + self.default_event_time - timedelta(days=5)) # lecture 1 lecture1_start_time = self.default_event_time - timedelta(weeks=1) @@ -746,7 +748,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): kind=self.default_event_kind, course=self.course, time=self.default_event_time, ordinal=2) - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() events_json = json.loads(resp.context["events_json"]) self.assertEqual(len(events_json), 2) @@ -810,7 +812,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): time=test_start_time, ordinal=None) - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() events_json = json.loads(resp.context["events_json"]) self.assertEqual(len(events_json), 3) @@ -858,7 +860,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): lecture3_start_time + timedelta(minutes=5)) # no EventInfo object - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() self.assertResponseContextEqual(resp, "event_info_list", []) def test_events_file_with_events_test3(self): @@ -871,7 +873,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): time=self.default_event_time, end_time=exam_end_time) - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() events_json = json.loads(resp.context["events_json"]) self.assertEqual(len(events_json), 1) @@ -907,7 +909,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): kind=self.default_event_kind, course=self.course, time=lecture3_start_time, ordinal=3) - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() events_json = json.loads(resp.context["events_json"]) self.assertEqual(len(events_json), 2) @@ -924,7 +926,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): lecture2_evt.end_time = lecture2_end_time lecture2_evt.save() - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() events_json = json.loads(resp.context["events_json"]) self.assertEqual(len(events_json), 2) @@ -949,7 +951,7 @@ class ViewCalendarTest(SingleCourseTestMixin, HackRepoMixin, TestCase): lecture2_end_time += timedelta(hours=1) - resp = self.get_course_calender_view() + resp = self.get_course_calendar_view() events_json = json.loads(resp.context["events_json"]) self.assertEqual(len(events_json), 2) diff --git a/tests/test_versioning.py b/tests/test_versioning.py index 9856709bc171d5e019c9643d445d0592d6674572..dd964241860131f18f66151b436aef6a5cc3e8e3 100644 --- a/tests/test_versioning.py +++ b/tests/test_versioning.py @@ -288,7 +288,12 @@ class ParamikoSSHVendorTest(unittest.TestCase): def test_invalid(self): from paramiko.ssh_exception import AuthenticationException - expected_error_msg = "Authentication failed" + expected_error_msgs = [ + "Authentication failed", + + # Raised when run in a user account that has + # an (encrypted) key file in $HOME/.ssh. + "Private key file is encrypted"] with self.assertRaises(AuthenticationException) as cm: # This is also used to ensure paramiko.client.MissingHostKeyPolicy # is added to the client @@ -297,7 +302,8 @@ class ParamikoSSHVendorTest(unittest.TestCase): command="git-upload-pack '/bar/baz'", username=None, port=None) - self.assertIn(expected_error_msg, str(cm.exception)) + self.assertTrue(any( + msg in str(cm.exception) for msg in expected_error_msgs)) with self.assertRaises(AuthenticationException) as cm: self.ssh_vendor.run_command( @@ -305,7 +311,8 @@ class ParamikoSSHVendorTest(unittest.TestCase): command="git-upload-pack '/bar/baz'", username="me", port=22) - self.assertIn(expected_error_msg, str(cm.exception)) + self.assertTrue(any( + msg in str(cm.exception) for msg in expected_error_msgs)) expected_error_msg = "Bad authentication type" @@ -985,7 +992,7 @@ class GetCommitMessageAsHtmlTest(VersioningRepoMixin, SingleCourseTestMixin, repo_dict = { commit_sha_1: FakeCommit("a_commit", message=b"test a > b "), commit_sha_2: FakeCommit("another_commit", message=b"

test

"), - commit_sha_3: FakeCommit("another_commit", message=b"abc\uDC80"), + commit_sha_3: FakeCommit("another_commit", message=b"abc\\uDC80"), } repo = mock.MagicMock() repo.__getitem__.side_effect = repo_dict.__getitem__