Commit 9d2fc3afe3f5fa90c00ad69ea16e537dde5f4b0b

Authored by Rodrigo Siqueira de Melo
Committed by Sergio Oliveira
1 parent 993c125e

Organize test environment, and removed unnessary files.

Signed-off-by: Matheus Fernandes <matheus.souza.fernandes@gmail.com>
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
@@ -88,3 +88,4 @@ Follow the steps below: @@ -88,3 +88,4 @@ Follow the steps below:
88 88
89 * Go to vagrant/colab/ 89 * Go to vagrant/colab/
90 * run: colab-admin test 90 * run: colab-admin test
  91 +* colab-admin collectstatic
colab/accounts/tests/test_request.py 0 → 100644
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
  1 +"""
  2 +Test account redirections.
  3 +Objective: Test requests.
  4 +"""
  5 +
  6 +from django.test import TestCase, Client
  7 +from django.test.client import RequestFactory
  8 +from django.contrib.messages.storage.fallback import FallbackStorage
  9 +from colab.accounts.views import ManageUserSubscriptionsView
  10 +from colab.accounts.views import UserProfileDetailView
  11 +from colab.accounts.models import User
  12 +from django.http.response import Http404
  13 +from colab.accounts.views import signup
  14 +
  15 +class RequestTest(TestCase):
  16 +
  17 + def setUp(self):
  18 + self.factory = RequestFactory()
  19 + self.client = Client()
  20 +
  21 + def test_successful_signup(self):
  22 + # TODO
  23 + pass
  24 +
  25 + def test_invalid_user_profile_url(self):
  26 + response = self.client.get('/account/johndoe/')
  27 + self.assertEqual(404, response.status_code)
  28 +
  29 + def test_valid_user_profile_url(self):
  30 + self.userTest = User()
  31 + self.userTest.username = "usertest"
  32 + self.userTest.email = "usertest@colab.com.br"
  33 + self.userTest.set_password("1234colab")
  34 + self.userTest.save()
  35 + response = self.client.get('/account/usertest/')
  36 + self.assertEqual(200, response.status_code)
  37 +
  38 + def test_valid_login_url(self):
  39 + response = self.client.get('/account/login')
  40 + self.assertEqual(200, response.status_code)
colab/accounts/tests/tests.py
@@ -1,56 +0,0 @@ @@ -1,56 +0,0 @@
1 -"""  
2 -This file demonstrates writing tests using the unittest module. These will pass  
3 -when you run "manage.py test".  
4 -  
5 -Replace this with more appropriate tests for your application.  
6 -"""  
7 -  
8 -from django.test import TestCase, Client  
9 -from django.test.client import RequestFactory  
10 -from django.contrib.messages.storage.fallback import FallbackStorage  
11 -from colab.accounts.views import ManageUserSubscriptionsView  
12 -from colab.accounts.views import UserProfileDetailView  
13 -from colab.accounts.models import User  
14 -from django.http.response import Http404  
15 -from colab.accounts.views import signup  
16 -  
17 -class AccountsTest(TestCase):  
18 -  
19 - def setUp(self):  
20 - self.factory = RequestFactory()  
21 - self.client = Client()  
22 -  
23 - def test_successful_signup(self):  
24 - form_data = {  
25 - 'first_name': 'John',  
26 - 'last_name': 'Doe',  
27 - 'email': 'john@doe.com',  
28 - 'username': 'johndoe',  
29 - }  
30 -  
31 - post_request = self.factory.post('/account/register/', data=form_data)  
32 -  
33 - # It makes unittest understant it must add messages  
34 - # See: https://code.djangoproject.com/ticket/17971  
35 - setattr(post_request, 'session', 'session')  
36 - messages = FallbackStorage(post_request)  
37 - setattr(post_request, '_messages', messages)  
38 -  
39 - response = signup(post_request)  
40 -  
41 - self.assertEqual('/account/johndoe', response['Location'])  
42 -  
43 -  
44 - def test_invalid_user_profile_url(self):  
45 - response = self.client.get('/account/johndoe/')  
46 - self.assertEqual(404, response.status_code)  
47 -  
48 - def test_valid_user_profile_url(self):  
49 - self.userTest = User()  
50 - self.userTest.username = "usertest"  
51 - self.userTest.email = "usertest@colab.com.br"  
52 - self.userTest.set_password("1234colab")  
53 - self.userTest.save()  
54 - response = self.client.get('/account/usertest/')  
55 - self.assertEqual(200, response.status_code)  
56 -  
colab/super_archives/fixtures/initial_data.json
@@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
1 -[  
2 - {  
3 - "pk": 1,  
4 - "model": "auth.group",  
5 - "fields": {  
6 - "name": "developer",  
7 - "permissions": []  
8 - }  
9 - }  
10 -]  
colab/super_archives/tests.py
@@ -1,16 +0,0 @@ @@ -1,16 +0,0 @@
1 -"""  
2 -This file demonstrates writing tests using the unittest module. These will pass  
3 -when you run "manage.py test".  
4 -  
5 -Replace this with more appropriate tests for your application.  
6 -"""  
7 -  
8 -from django.test import TestCase  
9 -  
10 -  
11 -class SimpleTest(TestCase):  
12 - def test_basic_addition(self):  
13 - """  
14 - Tests that 1 + 1 always equals 2.  
15 - """  
16 - self.assertEqual(1 + 1, 2)