fixed test
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils import unittest
|
||||
from student.models import CourseEnrollment
|
||||
|
||||
from django.db.models.signals import m2m_changed, pre_delete, pre_save, post_delete, post_save
|
||||
from django.dispatch.dispatcher import _make_id
|
||||
import string
|
||||
import random
|
||||
from .permissions import student_role, moderator_role, add_permission, has_permission
|
||||
from .permissions import has_permission, assign_default_role
|
||||
from .models import Role, Permission
|
||||
|
||||
|
||||
@@ -11,6 +15,17 @@ class PermissionsTestCase(unittest.TestCase):
|
||||
return ''.join(random.choice(chars) for x in range(length))
|
||||
|
||||
def setUp(self):
|
||||
|
||||
sender_receivers_to_keep = [
|
||||
(assign_default_role, CourseEnrollment),
|
||||
]
|
||||
super(PermissionsTestCase, self).setUp(sender_receivers_to_keep=sender_receivers_to_keep)
|
||||
|
||||
self.course_id = "MITx/6.002x/2012_Fall"
|
||||
|
||||
self.moderator_role = Role.objects.get_or_create(name="Moderator", course_id=self.course_id)[0]
|
||||
self.student_role = Role.objects.get_or_create(name="Student", course_id=self.course_id)[0]
|
||||
|
||||
self.student = User.objects.create(username=self.random_str(),
|
||||
password="123456", email="john@yahoo.com")
|
||||
self.moderator = User.objects.create(username=self.random_str(),
|
||||
@@ -33,4 +48,4 @@ class PermissionsTestCase(unittest.TestCase):
|
||||
self.assertTrue(has_permission(self.moderator, name))
|
||||
|
||||
add_permission(self.student, name)
|
||||
self.assertTrue(has_permission(self.student, name))
|
||||
self.assertTrue(has_permission(self.student, name))
|
||||
|
||||
62
lms/static/templates/_content.mustache
Normal file
62
lms/static/templates/_content.mustache
Normal file
@@ -0,0 +1,62 @@
|
||||
<div class="discussion-content">
|
||||
<div class="discussion-content-wrapper">
|
||||
<div class="discussion-votes">
|
||||
<a class="discussion-vote discussion-vote-up" href="javascript:void(0)">▲</a>
|
||||
<div class="discussion-votes-point">{{content.votes.point}}</div>
|
||||
<a class="discussion-vote discussion-vote-down" href="javascript:void(0)">▼</a>
|
||||
</div>
|
||||
<div class="discussion-right-wrapper">
|
||||
<ul class="admin-actions">
|
||||
<li><a href="javascript:void(0)" class="admin-endorse">Endorse</a></li>
|
||||
<li><a href="javascript:void(0)" class="admin-edit">Edit</a></li>
|
||||
<li><a href="javascript:void(0)" class="admin-delete">Delete</a></li>
|
||||
{{#thread}}
|
||||
<li><a href="javascript:void(0)" class="admin-openclose">{{close_thread_text}}</a></li>
|
||||
{{/thread}}
|
||||
</ul>
|
||||
{{#thread}}
|
||||
<a class="thread-title" name="{{content.id}}" href="javascript:void(0)">{{{content.displayed_title}}}</a>
|
||||
<div class="thread-raw-title" style="display: none">{{{content.title}}}</div>
|
||||
{{/thread}}
|
||||
<div class="discussion-content-view">
|
||||
<a name="{{content.id}}" style="width: 0; height: 0; padding: 0; border: none;"></a>
|
||||
<div class="content-body {{content.type}}-body" id="content-body-{{content.id}}">{{{content.displayed_body}}}</div>
|
||||
<div class="content-raw-body {{content.type}}-raw-body" style="display: none">{{{content.body}}}</div>
|
||||
{{#thread}}
|
||||
<div class="thread-tags">
|
||||
{{#content.tags}}
|
||||
<a class="thread-tag" href="{{##url_for_tags}}{{.}}{{/url_for_tags}}">{{.}}</a>
|
||||
{{/content.tags}}
|
||||
</div>
|
||||
<div class="thread-raw-tags" style="display: none">{{content.raw_tags}}</div>
|
||||
{{/thread}}
|
||||
<div class="info">
|
||||
<div class="comment-time">
|
||||
<span class="timeago" title="{{content.updated_at}}">sometime</span> by
|
||||
{{#content.anonymous}}
|
||||
anonymous
|
||||
{{/content.anonymous}}
|
||||
{{^content.anonymous}}
|
||||
<a href="{{##url_for_user}}{{content.user_id}}{{/url_for_user}}">{{content.username}}</a>
|
||||
{{/content.anonymous}}
|
||||
</div>
|
||||
<div class="comment-count">
|
||||
{{#thread}}
|
||||
{{#partial_comments}}
|
||||
<a href="javascript:void(0)" class="discussion-show-comments first-time">Show all comments ({{content.comments_count}} total)</a>
|
||||
{{/partial_comments}}
|
||||
{{^partial_comments}}
|
||||
<a href="javascript:void(0)" class="discussion-show-comments">Show {{##pluralize}}{{content.comments_count}} comment{{/pluralize}}</a>
|
||||
{{/partial_comments}}
|
||||
{{/thread}}
|
||||
</div>
|
||||
<ul class="discussion-actions">
|
||||
<li><a class="discussion-link discussion-reply discussion-reply-{{content.type}}" href="javascript:void(0)">Reply</a></li>
|
||||
<li><div class="follow-wrapper"></div></li>
|
||||
<li><a class="discussion-link discussion-permanent-link" href="javascript:void(0)">Permanent Link</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -31,3 +31,4 @@
|
||||
|
||||
<link href="${static.url('css/vendor/jquery.tagsinput.css')}" rel="stylesheet" type="text/css">
|
||||
<link href="${static.url('css/vendor/jquery.autocomplete.css')}" rel="stylesheet" type="text/css">
|
||||
<script type="text/template" id="content-template" src="${static.url('templates/_content.mustache')}"></script>
|
||||
|
||||
Reference in New Issue
Block a user