def test_remove_stuck_registration_with_an_addon(self): # Prevents circular import that prevents admin app from starting up from django.contrib.messages.storage.fallback import FallbackStorage self.registration.add_addon('github', auth=Auth(self.user)) view = RemoveStuckRegistrationsView() view = setup_log_view(view, self.request, guid=self.registration._id) setattr(self.request, 'session', 'session') messages = FallbackStorage(self.request) setattr(self.request, '_messages', messages) view.post(self.request) self.registration.refresh_from_db() nt.assert_true(self.registration.is_deleted)
def test_remove_stuck_registration(self): # Prevents circular import that prevents admin app from starting up from django.contrib.messages.storage.fallback import FallbackStorage view = RemoveStuckRegistrationsView() view = setup_log_view(view, self.request, guid=self.registration._id) # django.contrib.messages has a bug which effects unittests # more info here -> https://code.djangoproject.com/ticket/17971 setattr(self.request, 'session', 'session') messages = FallbackStorage(self.request) setattr(self.request, '_messages', messages) view.post(self.request) self.registration.refresh_from_db() nt.assert_true(self.registration.is_deleted)
def test_get_object(self): view = RemoveStuckRegistrationsView() view = setup_log_view(view, self.request, guid=self.registration._id) nt.assert_true(self.registration, view.get_object())