Skip to content

Commit

Permalink
Merge pull request #24 from Symphoria/master
Browse files Browse the repository at this point in the history
Wrote Tests (Issue #19)
  • Loading branch information
gauthamzz authored Jan 24, 2017
2 parents 37e9a07 + 72d59a6 commit daeceff
Show file tree
Hide file tree
Showing 12 changed files with 57,349 additions and 127 deletions.
56,701 changes: 56,701 additions & 0 deletions wsgi/stegolica/.idea/dataSources.ids

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions wsgi/stegolica/.idea/dataSources.local.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion wsgi/stegolica/.idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions wsgi/stegolica/.idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions wsgi/stegolica/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

702 changes: 597 additions & 105 deletions wsgi/stegolica/.idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions wsgi/stegolica/templates/question.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ <h5>{{instance}}</h5>


{%endblock content%}


2 changes: 2 additions & 0 deletions wsgi/stegolica/templates/ranking.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,6 @@
</div>
<a href='/' class="waves-effect waves-light btn" role="button">back</a>
<a href='/website/1' class="waves-effect waves-light btn" role="button">next</a>


{%endblock content%}
1 change: 1 addition & 0 deletions wsgi/stegolica/templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

</div>


<!-- </div>
</div> -->

Expand Down
2 changes: 0 additions & 2 deletions wsgi/stegolica/templates/registration/registration_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,4 @@





{% endblock %}
18 changes: 18 additions & 0 deletions wsgi/stegolica/website/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
from django.test import TestCase
from .models import Ranking
from django.urls import reverse


# Create your tests here.
def create_ranking_object(username, current_ques, time_started):
"""
Instantiate an object of Ranking model class
"""
return Ranking.objects.create(username=username, currentquestion=current_ques, timestarted=time_started)


class RankViewTest(TestCase):
def test_rank_view_for_queryset_length_per_page(self):
"""
The no of queries per page should not exceed 15
"""
create_ranking_object(username="Symphoria", current_ques="1", time_started="2017-01-20 23:56:06.967625")
response = self.client.get(reverse('website:ranks'))
self.assertIs(len(response.context['object_list']) > 15, False)
2 changes: 1 addition & 1 deletion wsgi/stegolica/website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def rank(request):
query = request.GET.get("q")
if query:
queryset_list = queryset_list.filter(Q(username__icontains=query)).distinct()
paginator = Paginator(queryset_list, 15) # Show 25 contacts per page
paginator = Paginator(queryset_list, 15) # Show 15 contacts per page
page = request.GET.get('page')
try:
queryset = paginator.page(page)
Expand Down

0 comments on commit daeceff

Please sign in to comment.