def test_get_queryset(self): self.node.set_title('New Title', auth=self.auth, save=True) view = AdminNodeLogView() view = setup_log_view(view, self.request, guid=self.node._id) logs = view.get_queryset() log_entry = logs.first() nt.assert_true(log_entry.action == 'edit_title') nt.assert_true(log_entry.params['title_new'] == u'New Title')
def test_get_queryset(self): self.node.set_title('New Title', auth=self.auth, save=True) view = AdminNodeLogView() view = setup_log_view(view, self.request, guid=self.node._id) logs = view.get_queryset() log_entry = logs.last() nt.assert_true(log_entry.action == 'edit_title') nt.assert_true(log_entry.params['title_new'] == u'New Title')
def test_get_context_data(self): self.node.set_title('New Title', auth=self.auth, save=True) view = AdminNodeLogView() view = setup_log_view(view, self.request, guid=self.node._id) logs = view.get_context_data()['logs'] log_entry = logs[0][0] log_params = logs[0][1] nt.assert_true(log_entry.action == NodeLog.EDITED_TITLE) nt.assert_true((u'title_new', u'New Title') in log_params) nt.assert_true((u'node', self.node._id) in log_params)
def test_get_logs_for_children(self): """ The "create component" action is actually logged as a create_project action for its child with a log parameter 'node' having its guid as a value. We have to ensure that all the components a parent has created appear in its admin app logs, so we can't just do node.logs.all(), that will leave out component creation. """ component = ProjectFactory(creator=self.user, parent=self.node) component.save() view = AdminNodeLogView() view = setup_log_view(view, self.request, guid=self.node._id) logs = view.get_context_data()['logs'] log_entry = logs[0][0] log_params = logs[0][1] nt.assert_true(log_entry.action == NodeLog.PROJECT_CREATED) nt.assert_true(log_entry.node._id == component._id) nt.assert_true(('node', component._id) in log_params)
def test_get_object(self): view = AdminNodeLogView() view = setup_log_view(view, self.request, guid=self.node._id) nt.assert_true(self.node, view.get_object())