Commit d58bf804c9de7b7562ab343a356853faa97783db

Authored by Gustavo Bernardo
1 parent a1c981cf

Initiating the create link test [Issue #123]

Showing 1 changed file with 31 additions and 1 deletions   Show diff stats
links/tests.py
1   -from django.test import TestCase
  1 +from django.test import TestCase,Client
  2 +from django.core.urlresolvers import reverse
  3 +from rolepermissions.shortcuts import assign_role
  4 +
  5 +from users.models import User
  6 +from .models import *
2 7  
3 8 # Create your tests here.
  9 +class LinkTestCase(TestCase):
  10 + def setUp(self):
  11 + self.client = Client()
  12 + self.user = User.objects.create_user(
  13 + username = 'test',
  14 + email = 'testing@amadeus.com',
  15 + is_staff = True,
  16 + is_active = True,
  17 + password = 'testing'
  18 + )
  19 + assign_role(self.user, 'system_admin')
  20 + def test_create_link(self):
  21 + self.client.login(username='user', password = 'testing')
  22 + links = Link.objects.all().count()
  23 + self.assertEqual(Link.objects.all().count(),links) #Before creating the link
  24 + self.link = Link.objects.create(
  25 + name = 'testinglink',
  26 + description = 'testdescription',
  27 + link = 'teste.com'
  28 + )
  29 + self.assertEqual(Link.objects.all().count(),links+1) #After creating one link, if OK, the link was created successfully.
  30 + # def test_update_link():
  31 + # pass
  32 + # def test_delete_link():
  33 + # pass
... ...