summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshen2018-08-08 12:17:55 +0530
committerGitHub2018-08-08 12:17:55 +0530
commitd0cebb62f99acdd29630a1f5772b253a28f4fa1d (patch)
treeda1b73420e2528e71b6b06e4223a58ec0ded566e
parent62938c235ccce2dcbc7c6a806beb249b7c11f2b4 (diff)
parentc90b389e388a572862e484fb7b0b674f8c676dd7 (diff)
downloadworkshop_booking-d0cebb62f99acdd29630a1f5772b253a28f4fa1d.tar.gz
workshop_booking-d0cebb62f99acdd29630a1f5772b253a28f4fa1d.tar.bz2
workshop_booking-d0cebb62f99acdd29630a1f5772b253a28f4fa1d.zip
Merge pull request #66 from Akshen/develop
Add testcases for ProfileComments Model
-rw-r--r--README.md1
-rw-r--r--docs/Getting_Started.md2
-rw-r--r--workshop_app/admin.py8
-rw-r--r--workshop_app/models.py4
-rw-r--r--workshop_app/tests/test_models.py26
5 files changed, 38 insertions, 3 deletions
diff --git a/README.md b/README.md
index 4596ea2..7c70a62 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,7 @@
* Monthly Workshop Count
* Instructor/Coordinator Profile stats
* Upcoming Workshops
+ * View/Post comments on Coordinator's Profile
2. Open to All
* Workshops taken over Map of India
* Pie chart based on Total Workshops taken to Type of Workshops.
diff --git a/docs/Getting_Started.md b/docs/Getting_Started.md
index 551ddf3..e7da178 100644
--- a/docs/Getting_Started.md
+++ b/docs/Getting_Started.md
@@ -33,6 +33,8 @@
2. Instructor can see monthly workshop count, upcoming workshop etc. in Statistics > Workshop Statistics
+3. Instructors can view and post comments on coordinator's profile from Profile Statistics or Workshop Status page.
+
### Coordinator specific steps
diff --git a/workshop_app/admin.py b/workshop_app/admin.py
index 1b7ae9d..5e7b82f 100644
--- a/workshop_app/admin.py
+++ b/workshop_app/admin.py
@@ -5,7 +5,7 @@ from .models import (
Profile, WorkshopType,
Workshop, ProposeWorkshopDate,
RequestedWorkshop, BookedWorkshop,
- Testimonial
+ Testimonial, ProfileComments
)
try:
from StringIO import StringIO as string_io
@@ -192,6 +192,11 @@ class BookedWorkshopAdmin(admin.ModelAdmin):
download_csv.short_description = "Download CSV file for selected stats."
+
+class ProfileCommentAdmin(admin.ModelAdmin):
+ list_display = ['comment', 'created_date', 'coordinator_profile', 'instructor_profile']
+
+
# Register your models here.
admin.site.register(Profile, ProfileAdmin)
admin.site.register(WorkshopType, WorkshopTypeAdmin)
@@ -200,3 +205,4 @@ admin.site.register(ProposeWorkshopDate, ProposeWorkshopDateAdmin)
admin.site.register(RequestedWorkshop, RequestedWorkshopAdmin)
admin.site.register(BookedWorkshop, BookedWorkshopAdmin)
admin.site.register(Testimonial, TestimonialAdmin)
+admin.site.register(ProfileComments, ProfileCommentAdmin)
diff --git a/workshop_app/models.py b/workshop_app/models.py
index 3f78e1d..04c3227 100644
--- a/workshop_app/models.py
+++ b/workshop_app/models.py
@@ -288,5 +288,7 @@ class ProfileComments(models.Model):
def __str__(self):
return u"{0} | {1}".format(
self.comment,
- self.created_date
+ self.created_date,
+ self.coordinator_profile,
+ self.instructor_profile
) \ No newline at end of file
diff --git a/workshop_app/tests/test_models.py b/workshop_app/tests/test_models.py
index 1be74a0..6b3f15a 100644
--- a/workshop_app/tests/test_models.py
+++ b/workshop_app/tests/test_models.py
@@ -2,7 +2,7 @@ from django.test import TestCase
from workshop_app.models import (
Profile, User, Workshop, WorkshopType,
RequestedWorkshop, BookedWorkshop, ProposeWorkshopDate,
- Testimonial
+ Testimonial, ProfileComments
)
from datetime import datetime
@@ -196,6 +196,8 @@ class BookedWorkshopModelTest(TestCase):
self.assertEqual(self.bwr.booked_workshop_requested.requested_workshop_title.workshoptype_name,
'ISCP' )
+
+
class TestimonialModelTest(TestCase):
'''
This class tests the Testimonial Model
@@ -224,3 +226,25 @@ class TestimonialModelTest(TestCase):
consequat. Duis aute irure dolor in reprehenderit in voluptat\
cillum dolore eu fugiat nulla pariatur. Excepteur sint \
proident, sunt in culpa qui officia deserunt mollit anim')
+
+
+
+class ProfileCommentsTest(TestCase):
+ '''
+ This class tests the ProfileComments Model
+ '''
+
+ def setUp(self):
+ self.coordinator_prof = User.objects.get(username='demouser2')
+ self.instructor_prof = User.objects.get(username='testuser2')
+
+ self.comment = ProfileComments.objects.create(
+ coordinator_profile=self.coordinator_prof,
+ comment="This is a test comment",
+ instructor_profile=self.instructor_prof,
+ created_date='2017-06-06 12:00:12'
+ )
+
+ def test_profilecomments_model(self):
+ self.assertEqual(self.coordinator_prof.email, 'test.user@gmail.com')
+ self.assertEqual(self.comment.comment, 'This is a test comment') \ No newline at end of file