Here are the examples of the python api subdomains.utils.reverse taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
199 Examples
3
Example 1
Project: write-it Source File: message_creation_tests.py
def test_if_theres_a_single_contact_skip_the_first_step(self):
'''If theres a single contact skip the first step and select the single person'''
url = reverse('write_message_step',
subdomain=self.writeitinstance.slug,
kwargs={'step': 'who'})
# Deleting Marcel
self.writeitinstance.persons.get(id=2).delete()
# ok so I've deleted Marcel from the list of people that is in this instance
# so when I get this response I'm expecting to take me directly to
# the second step .
response = self.client.get(url)
url2 = reverse('write_message_step',
subdomain=self.writeitinstance.slug,
kwargs={'step': 'draft'})
self.assertRedirects(response, url2)
response2 = self.client.get(url2)
self.assertEquals(response2.status_code, 200)
3
Example 2
Project: write-it Source File: popit_writeit_relation_tests.py
@popit_load_data()
def test_doesnt_add_another_relation_w_p(self):
'''
If a user posts to the server using another popit_api that has not previously been related
it does not add another relation
'''
another_popit_api_instance = PopitApiInstance.objects.last()
self.assertNotIn(another_popit_api_instance,
self.writeitinstance.writeitinstancepopitinstancerecord_set.all())
url = reverse('resync-from-popit', subdomain=self.writeitinstance.slug, kwargs={
'popit_api_pk': another_popit_api_instance.pk})
request = self.request_factory.post(url)
request.subdomain = self.writeitinstance.slug
request.user = self.owner
with self.assertRaises(Http404):
ReSyncFromPopit.as_view()(request, popit_api_pk=another_popit_api_instance.pk)
3
Example 3
Project: write-it Source File: confirmation_test.py
def test_confirmation_get_absolute_url(self):
confirmation = Confirmation.objects.create(message=self.message)
expected_url = reverse(
'confirm',
subdomain=self.message.writeitinstance.slug,
kwargs={'slug': confirmation.key},
)
self.assertEquals(expected_url, confirmation.get_absolute_url())
3
Example 4
Project: write-it Source File: messages_per_person_view_test.py
def test_the_person_does_exist_but_not_the_instance(self):
marcel = Person.objects.get(id=2)
url = reverse(
'thread_to',
subdomain='non-existing-slug',
kwargs={
'pk': marcel.id,
},
)
response = self.client.get(url)
self.assertEquals(response.status_code, 404)
3
Example 5
Project: write-it Source File: contact_us_tests.py
def test_get_the_contact_us_url(self):
user = User.objects.get(id=1)
url = reverse('contact_us', subdomain=None)
self.client.login(username=user.username, password='admin')
response = self.client.get(url)
self.assertEquals(response.status_code, 200)
self.assertTemplateUsed(response, 'nuntium/profiles/contact.html')
3
Example 6
Project: write-it Source File: models.py
def get_reject_url(self):
return reverse('moderation_rejected',
subdomain=self.message.writeitinstance.slug,
kwargs={
'slug': self.key
})
3
Example 7
Project: write-it Source File: moderation_messages_test.py
def test_moderation_get_reject_url(self):
expected_url = reverse('moderation_rejected',
subdomain=self.private_message.writeitinstance.slug,
kwargs={
'slug': self.private_message.moderation.key
})
self.assertEquals(self.private_message.moderation.get_reject_url(), expected_url)
3
Example 8
Project: write-it Source File: contacts_toggle_enable_tests.py
def test_post_result_content(self):
'''When posting we the response contains the contact id and the status'''
url = reverse('toggle-enabled', subdomain=self.writeitinstance.slug)
self.client.login(username=self.user.username, password='fiera')
response = self.client.post(url, data={'id': self.contact.pk})
json_answer = json.loads(response.content)
self.assertIn('contact', json_answer.keys())
self.assertEquals(json_answer['contact']['id'], self.contact.pk)
self.assertFalse(json_answer['contact']['enabled'])
response = self.client.post(url, data={'id': self.contact.pk})
json_answer = json.loads(response.content)
self.assertTrue(json_answer['contact']['enabled'])
3
Example 9
Project: write-it Source File: popit_writeit_relation_tests.py
def test_cannot_get_it_should_return_405(self):
url = reverse('update-popit-writeit-relation',
subdomain=self.writeitinstance.slug,
kwargs={
'pk': self.popit_writeit_record.pk
}
)
request = self.request_factory.get(url)
request.subdomain = self.writeitinstance.slug
request.user = self.owner
request.GET = {'periodicity': 'invalid'}
response = WriteItPopitUpdateView.as_view()(request, pk=self.popit_writeit_record.pk)
self.assertEquals(response.status_code, 405)
3
Example 10
Project: write-it Source File: contacts_toggle_enable_tests.py
def test_if_not_user_it_returns_404(self):
'''If a user that is not owner tries to post returns 404'''
url = reverse('toggle-enabled', subdomain=self.writeitinstance.slug)
User.objects.create_user(username="not_owner", password="123456")
self.client.login(username="not_owner", password="123456")
response = self.client.post(url, data={'id': self.contact.pk})
self.assertEquals(response.status_code, 404)
3
Example 11
Project: write-it Source File: messages_per_person_view_test.py
def test_person_id_param(self):
url = reverse(
'messages_per_person_id',
subdomain=self.writeitinstance.slug,
kwargs={
'person_id': self.pedro.popit_id,
}
)
response = self.client.get(url)
self.assertEquals(response.context['person'], self.pedro)
3
Example 12
Project: write-it Source File: home_view_tests.py
def test_list_instances_view(self):
'''All instances are displayed in home'''
for instance in WriteItInstance.objects.all():
instance.config.testing_mode = False
instance.config.save()
url = reverse('instance_list')
self.assertTrue(url)
c = Client()
response = c.get(url)
self.assertEquals(response.status_code, 200)
self.assertIn('object_list', response.context)
self.assertIsInstance(response.context['object_list'][0], WriteItInstance)
self.assertEquals(len(response.context['object_list']), WriteItInstance.objects.count())
self.assertTemplateUsed(response, 'nuntium/template_list.html')
3
Example 13
def get_absolute_url(self):
return reverse(
'thread_read',
subdomain=self.writeitinstance.slug,
kwargs={
'slug': self.slug,
},
)
3
Example 14
Project: write-it Source File: messages_search_test.py
def test_per_instance_search_url(self):
url = reverse('instance_search', subdomain=self.writeitinstance.slug)
response = self.client.get(url)
self.assertEquals(response.status_code, 200)
self.assertTemplateUsed(response, 'nuntium/instance_search.html')
self.assertIn('form', response.context)
self.assertIsInstance(response.context['form'], PerInstanceSearchForm)
3
Example 15
Project: write-it Source File: contacts_tests.py
def test_a_non_owner_cannot_update_a_contact(self):
url = reverse('contact_value_update', kwargs={'pk': self.contact.pk})
User.objects.create_user(username="not_owner", password="123456")
c = Client()
c.login(username='not_owner', password='123456')
data = {'value': '[email protected]'}
response = c.post(url, data=data)
self.assertEquals(response.status_code, 404)
3
Example 16
Project: write-it Source File: moderation_messages_test.py
def test_outbound_messages_of_a_confirmed_message_are_waiting_for_moderation(self):
# I need to do a get to the confirmation url
moderation, created = Moderation.objects.get_or_create(message=self.private_message)
url = reverse(
'confirm',
subdomain=self.private_message.writeitinstance.slug,
kwargs={
'slug': self.confirmation.key
},
)
self.client.get(url)
# this works proven somewhere else
outbound_message_to_pedro = OutboundMessage.objects.get(message=self.private_message)
self.assertEquals(outbound_message_to_pedro.status, 'needmodera')
3
Example 17
Project: write-it Source File: answer_attachments_tests.py
def test_using_a_pdf(self):
'''Downloading a PDF file'''
attachment = AnswerAttachment.objects.create(answer=self.answer, content=self.pdf_file)
url = reverse('attachment', subdomain=self.message.writeitinstance.slug, kwargs={
'pk': attachment.pk,
})
response = self.client.get(url)
self.assertIn('attachment', response.get('Content-Disposition'))
self.assertIn('filename=hello.pd', response.get('Content-Disposition'))
self.assertIn('.pdf', response.get('Content-Disposition'))
3
Example 18
Project: write-it Source File: moderation_messages_test.py
def test_non_authenticated_users_cant_reject_messages(self):
"""Moderation reject links require users to be logged in"""
self.confirmation.confirmated_at = datetime.datetime.now()
self.confirmation.save()
self.private_message.confirmated = True
self.private_message.save()
url = reverse('moderation_rejected',
subdomain=self.private_message.writeitinstance.slug,
kwargs={
'slug': self.private_message.moderation.key
})
response = self.client.get(url)
self.assertEquals(response.status_code, 302)
outbound_message_to_pedro = OutboundMessage.objects.get(message=self.private_message.id)
self.assertEquals(outbound_message_to_pedro.status, 'new')
private_message = Message.objects.get(id=self.private_message.id)
self.assertFalse(private_message.moderated)
3
Example 19
Project: write-it Source File: contacts_tests.py
def test_get_contact_value_update_view_not_allowed(self):
url = reverse('contact_value_update', kwargs={'pk': self.contact.pk})
c = Client()
c.login(username='fiera', password="feroz")
response = c.get(url)
self.assertEquals(response.status_code, 405)
3
Example 20
def test_form_invalid(self):
url = reverse('update-popit-writeit-relation',
subdomain=self.writeitinstance.slug,
kwargs={
'pk': self.popit_writeit_record.pk
}
)
request = self.request_factory.post(url)
request.subdomain = self.writeitinstance.slug
request.user = self.owner
request.POST = {'periodicity': 'invalid'}
response = WriteItPopitUpdateView.as_view()(request, pk=self.popit_writeit_record.pk)
# I'm hoping this to be an ajax call
self.assertEquals(response.status_code, 200)
response_object = json.loads(response.content)
self.assertTrue(response_object['errors'])
3
Example 21
Project: write-it Source File: confirmation_test.py
def test_it_does_not_confirm_twice(self):
confirmation = Confirmation.objects.create(message=self.message)
url = reverse(
'confirm',
subdomain=self.message.writeitinstance.slug,
kwargs={'slug': confirmation.key},
)
response1 = self.client.get(url)
message_thread = reverse(
'thread_read', subdomain=self.message.writeitinstance.slug,
kwargs={
'slug': self.message.slug
})
response2 = self.client.get(url)
self.assertEquals(response1.status_code, 302)
self.assertRedirects(response2, message_thread)
3
Example 22
Project: write-it Source File: confirmation_test.py
def test_i_cannot_access_a_non_confirmed_message(self):
Confirmation.objects.create(message=self.message)
url = reverse('thread_read', subdomain=self.message.writeitinstance.slug, kwargs={'slug': self.message.slug})
response = self.client.get(url)
self.assertEquals(response.status_code, 404)
3
Example 23
Project: write-it Source File: contacts_tests.py
def test_get_update_contact(self):
url = reverse('contact_value_update', kwargs={'pk': self.contact.pk})
c = Client()
c.login(username='fiera', password="feroz")
data = {'value': '[email protected]'}
response = c.post(url, data=data)
self.assertEquals(response.status_code, 200)
contact = Contact.objects.get(id=self.contact.id)
self.assertEquals(contact.value, data['value'])
self.assertEquals(response['Content-Type'], 'application/json')
json_answer = json.loads(response.content)
self.assertEquals(json_answer['contact']['value'], data['value'])
3
Example 24
def test_list_instances(self):
activate('en')
instance1 = WriteItInstance.objects.get(id=1)
url = reverse("home")
response = self.client.get(url)
self.assertEquals(response.status_code, 200)
self.assertTrue(response.context['writeitinstances'])
self.assertEquals(response.context['writeitinstances'].count(), 2)
self.assertEquals(response.context['writeitinstances'][0], instance1)
3
Example 25
Project: write-it Source File: contacts_toggle_enable_tests.py
def test_it_does_not_try_to_send_emails_when_saving(self):
'''It does not send emails when saving'''
url = reverse('toggle-enabled', subdomain=self.writeitinstance.slug)
self.client.login(username=self.user.username, password='fiera')
response = self.client.post(url, data={'id': self.contact.pk})
self.assertEquals(response.status_code, 200)
contact = Contact.objects.get(id=self.contact.id)
self.assertFalse(contact.is_bounced)
self.assertEquals(len(mail.outbox), 0)
3
Example 26
Project: write-it Source File: messages_per_person_view_test.py
def test_has_an_url(self):
url = reverse(
'messages_per_person',
subdomain=self.writeitinstance.slug,
kwargs={
'pk': self.pedro.id,
}
)
self.assertTrue(url)
3
Example 27
Project: write-it Source File: home_view_tests.py
def test_testing_mode_instances_not_displayed(self):
'''Test Mode instances are not displayed if a user is not logged in'''
fiera = User.objects.create_user(username='fiera',
password="feroz",
email="[email protected]")
w = WriteItInstance.objects.create(name='test_mode_instance', owner=fiera)
c = Client()
response = c.get(reverse('instance_list'))
self.assertEquals(response.status_code, 200)
self.assertNotIn(w, response.context['object_list'])
3
Example 28
Project: write-it Source File: plugin_test.py
def test_a_non_logged_user_is_told_to_login(self):
url = reverse('mailit-template-update', subdomain=self.writeitinstance.slug)
c = self.client
data = {
'subject_template': 'Hello there you have a new mail this is subject',
'content_template': 'hello there this is the content and you got this message',
'content_html_template': '<tag>hello there this is the content and you got this message</tag>',
}
response = c.post(url, data=data)
self.assertRedirectToLogin(response)
3
Example 29
Project: write-it Source File: messages_per_person_view_test.py
def test_person_non_existing_throws_500(self):
url = reverse(
'thread_to',
subdomain=self.writeitinstance.slug,
kwargs={
'pk': 1313,
},
)
response = self.client.get(url)
self.assertEquals(response.status_code, 404)
3
Example 30
Project: write-it Source File: contacts_tests.py
def test_a_non_login_cannot_update(self):
url = reverse('contact_value_update', kwargs={'pk': self.contact.pk})
#not_the_owner = User.objects.create_user(username="not_owner", password="123456")
c = Client()
#c.login(username='not_owner', password='123456')
data = {'value': '[email protected]'}
response = c.post(url, data=data)
self.assertRedirectToLogin(response)
3
Example 31
Project: write-it Source File: messages_search_test.py
def test_access_the_search_url(self):
url = reverse('search_messages')
url += '/'
response = self.client.get(url)
self.assertEquals(response.status_code, 200)
self.assertIsInstance(response.context['form'], MessageSearchForm)
3
Example 32
def get_success_url(self):
return reverse('moderation_accept',
subdomain=self.message.writeitinstance.slug,
kwargs={
'slug': self.key
})
3
Example 33
Project: write-it Source File: message_creation_tests.py
def test_go_straight_to_draft_given_person_id(self):
url = reverse('write_message_step',
subdomain=self.writeitinstance.slug,
kwargs={'step': 'who'})
url2 = reverse('write_message_step',
subdomain=self.writeitinstance.slug,
kwargs={'step': 'draft'})
response = self.client.get(url, {'person_id': self.person1.popit_id})
self.assertRedirects(response, url2)
response = self.client.get(url2)
self.assertEquals(response.context['message']['persons'][0].id, self.person1.id)
3
Example 34
Project: write-it Source File: contacts_tests.py
def test_get_create_form(self):
'''Get the form to display'''
url = reverse('create-new-contact', kwargs={'pk': self.writeitinstance.pk, 'person_pk': self.pedro.id})
self.assertTrue(url)
c = Client()
c.login(username=self.user.username, password="fiera")
response = c.get(url)
self.assertEquals(response.status_code, 200)
self.assertTemplateUsed(response, 'nuntium/profiles/contacts/create_new_contact_form.html')
3
Example 35
def test_get_the_url(self):
url = reverse('message_threads', subdomain=self.writeitinstance.slug)
response = self.client.get(url)
self.assertEquals(response.status_code, 200)
public_messages = Message.public_objects.filter(writeitinstance=self.writeitinstance)
self.assertEquals(len(response.context['message_list']), public_messages.count())
3
Example 36
Project: write-it Source File: answer_attachments_tests.py
def test_there_is_a_url_for_this_attachment(self):
'''There is a url for an attachment'''
attachment = AnswerAttachment.objects.create(answer=self.answer, content=self.photo_fiera)
url = reverse('attachment', subdomain=self.message.writeitinstance.slug, kwargs={
'pk': attachment.pk,
})
response = self.client.get(url)
self.assertIn('attachment', response.get('Content-Disposition'))
self.assertIn('filename=fiera_parque', response.get('Content-Disposition'))
self.assertIn('.jpg', response.get('Content-Disposition'))
3
Example 37
Project: write-it Source File: moderation_messages_test.py
def test_moderation_get_success_url(self):
expected_url = reverse('moderation_accept',
self.private_message.writeitinstance.slug,
kwargs={
'slug': self.private_message.moderation.key
})
self.assertEquals(self.private_message.moderation.get_success_url(), expected_url)
3
Example 38
def test_post_to_the_url(self):
'''
By posting to toggle-enabled you
can toggle enabled or disabled a contact
'''
url = reverse('toggle-enabled', subdomain=self.writeitinstance.slug)
self.client.login(username=self.user.username, password='fiera')
response = self.client.post(url, data={'id': self.contact.pk})
self.assertEquals(response.status_code, 200)
contact = Contact.objects.get(id=self.contact.id)
self.assertFalse(contact.enabled)
3
Example 39
Project: write-it Source File: moderation_messages_test.py
def test_non_authenticated_users_cant_accept_messages(self):
"""Moderation accept links require users to be logged in"""
self.confirmation.confirmated_at = datetime.datetime.now()
self.confirmation.save()
self.private_message.confirmated = True
self.private_message.save()
url = reverse('moderation_accept',
subdomain=self.private_message.writeitinstance.slug,
kwargs={
'slug': self.private_message.moderation.key
})
response = self.client.get(url)
self.assertEquals(response.status_code, 302)
outbound_message_to_pedro = OutboundMessage.objects.get(message=self.private_message.id)
self.assertEquals(outbound_message_to_pedro.status, 'new')
private_message = Message.objects.get(id=self.private_message.id)
self.assertFalse(private_message.moderated)
3
Example 40
Project: write-it Source File: confirmation_test.py
def test_it_sends_an_email_to_the_author_asking_for_confirmation(self):
confirmation = Confirmation.objects.create(message=self.message)
url = reverse(
'confirm',
subdomain=self.message.writeitinstance.slug,
kwargs={'slug': confirmation.key},
)
confirmation_full_url = url
self.assertEquals(len(mail.outbox), 1) # it is sent to one person pointed in the contact
self.assertEquals(mail.outbox[0].subject, u'Please confirm your message to Felipe')
self.assertTrue(self.message.author_name in mail.outbox[0].body)
self.assertIn(confirmation_full_url, mail.outbox[0].body)
self.assertTrue(url in mail.outbox[0].body)
self.assertEquals(len(mail.outbox[0].to), 1)
self.assertTrue(self.message.author_email in mail.outbox[0].to)
expected_from_email = self.message.writeitinstance.slug + "@" + settings.DEFAULT_FROM_DOMAIN
self.assertEquals(mail.outbox[0].from_email, expected_from_email)
3
Example 41
Project: write-it Source File: popit_writeit_relation_tests.py
@popit_load_data()
def test_post_to_the_url_for_manual_resync(self):
'''Resyncing can be done by posting to a url'''
# This is just a symbolism but it is to show how this popit api is empty
self.assertFalse(self.popit_api_instance.person_set.all())
url = reverse('resync-from-popit', subdomain=self.writeitinstance.slug, kwargs={
'popit_api_pk': self.popit_api_instance.pk})
request = self.request_factory.post(url)
request.subdomain = self.writeitinstance.slug
request.user = self.owner
response = ReSyncFromPopit.as_view()(request, popit_api_pk=self.popit_api_instance.pk)
self.assertEquals(response.status_code, 200)
# It should have been updated
self.assertTrue(self.popit_api_instance.person_set.all())
3
Example 42
Project: django-subdomains Source File: tests.py
def test_wildcard_reverse(self):
# Falls through to settings.ROOT_URLCONF
subdomain = 'wildcard'
self.assertEqual(reverse('home', subdomain),
'http://%s.%s/' % (subdomain, self.DOMAIN))
self.assertEqual(reverse('view', subdomain),
'http://%s.%s/view/' % (subdomain, self.DOMAIN))
3
Example 43
Project: write-it Source File: popit_writeit_relation_tests.py
def test_post_has_to_be_the_owner_of_the_instance(self):
'''Only the owner of an instance can resync'''
url = reverse('resync-from-popit', subdomain=self.writeitinstance.slug, kwargs={
'popit_api_pk': self.popit_api_instance.pk})
request = self.request_factory.post(url)
request.subdomain = self.writeitinstance.slug
request.user = AnonymousUser()
with self.assertRaises(Http404):
ReSyncFromPopit.as_view()(request, popit_api_pk=self.popit_api_instance.pk)
other_user = User.objects.create_user(username="other_user", password="s3cr3t0")
request = self.request_factory.post(url)
request.subdomain = self.writeitinstance.slug
request.user = other_user
with self.assertRaises(Http404):
ReSyncFromPopit.as_view()(request, popit_api_pk=self.popit_api_instance.pk)
3
Example 44
Project: write-it Source File: confirmation_test.py
def test_access_the_confirmation_url(self):
confirmation = Confirmation.objects.create(message=self.message)
url = reverse(
'confirm',
subdomain=self.message.writeitinstance.slug,
kwargs={'slug': confirmation.key},
)
message_url = reverse('thread_read',
subdomain=self.message.writeitinstance.slug,
kwargs={'slug': self.message.slug}
)
response = self.client.get(url)
self.assertRedirects(response, message_url)
confirmation = Confirmation.objects.get(id=confirmation.id)
self.assertTrue(confirmation.confirmated_at is not None)
outbound_messages = OutboundMessage.objects.filter(message=confirmation.message)
self.assertEquals(outbound_messages[0].status, "ready")
3
Example 45
Project: write-it Source File: contacts_toggle_enable_tests.py
def test_only_owner_of_instance_can_change_status(self):
'''Only the owner of the instances contact can toggle enabled'''
url = reverse('toggle-enabled', subdomain=self.writeitinstance.slug)
response = self.client.post(url, data={'id': self.contact.pk})
self.assertRedirectToLogin(response)
3
Example 46
Project: django-subdomains Source File: tests.py
def test_explicit_reverse(self):
# Uses explicitly provided settings.SUBDOMAIN_URLCONF[subdomain]
self.assertEqual(reverse('home', subdomain='api'),
'http://api.%s/' % self.DOMAIN)
self.assertEqual(reverse('view', subdomain='api'),
'http://api.%s/view/' % self.DOMAIN)
3
Example 47
Project: django-subdomains Source File: tests.py
def test_using_not_default_urlconf(self):
# Ensure that changing the currently active URLconf to something other
# than the default still resolves wildcard subdomains correctly.
set_urlconf(self.get_path_to_urlconf('api'))
subdomain = 'wildcard'
# This will raise NoReverseMatch if we're using the wrong URLconf for
# the provided subdomain.
self.assertEqual(reverse('application', subdomain=subdomain),
'http://%s.%s/application/' % (subdomain, self.DOMAIN))
3
Example 48
Project: write-it Source File: contacts_tests.py
def test_get_update_contact_bounced_status(self):
url = reverse('contact_value_update', kwargs={'pk': self.contact.pk})
self.contact.is_bounced = True
self.contact.save()
c = Client()
c.login(username='fiera', password="feroz")
data = {'value': '[email protected]'}
c.post(url, data=data)
contact = Contact.objects.get(id=self.contact.id)
self.assertFalse(contact.is_bounced)
3
Example 49
Project: write-it Source File: plugin_test.py
def test_a_non_owner_cannot_update_a_template(self):
User.objects.create_user(username="not_owner", password="secreto")
url = reverse('mailit-template-update', subdomain=self.writeitinstance.slug)
c = self.client
c.login(username="not_owner", password="secreto")
data = {
'subject_template': 'Hello there you have a new mail this is subject',
'content_template': 'hello there this is the content and you got this message',
'content_html_template': '<tag>hello there this is the content and you got this message</tag>',
}
response = c.post(url, data=data)
self.assertEquals(response.status_code, 404)
3
Example 50
Project: write-it Source File: home_view_tests.py
def test_it_does_not_repeat_instances(self):
'''It does not repeat instances'''
fiera = User.objects.create_user(username='fiera',
password="feroz",
email="[email protected]")
fieras_instance = WriteItInstance.objects.create(name='test_mode_instance',
owner=fiera)
fieras_instance.config.testing_mode = False
fieras_instance.config.save()
c = Client()
c.login(username='fiera', password="feroz")
response = c.get(reverse('instance_list'))
self.assertEquals(response.context['object_list'].count(fieras_instance), 1)