Model changes (#22)
* updated changes for heroku * updated changes for heroku * updated changes for heroku * updated changes for heroku * updated settings file * update changes for opportunities * update rst file * fixed testcases for accounts, common
This commit is contained in:
parent
346d4463cc
commit
a0761cbd4b
6 changed files with 41 additions and 51 deletions
|
|
@ -1,7 +1,7 @@
|
|||
from django.test import TestCase
|
||||
from common.models import *
|
||||
from accounts.models import Account
|
||||
from django.contrib.auth.models import User
|
||||
from common.models import User
|
||||
|
||||
|
||||
# Create your tests here.
|
||||
|
|
@ -9,18 +9,17 @@ from django.contrib.auth.models import User
|
|||
|
||||
class AccountCreateTest(object):
|
||||
def setUp(self):
|
||||
self.country = Country.objects.create(
|
||||
iso_3166_1_a2="IN", iso_3166_1_a3="IND", iso_3166_1_numeric="01", printable_name="INDIA", name="INDIA", is_shipping_country="True")
|
||||
self.address = Address.objects.create(
|
||||
street="KPHB", city="HYDERABAD", state="ANDHRA PRADESH", postcode="500073", country=Country.objects.get(pk=1))
|
||||
self.account = Account.objects.create(
|
||||
name="Uday", email="udayteja@micropyramid.com", phone="8333855552", billing_address=self.address,
|
||||
shipping_address=self.address, website="www.uday.com", account_type="PARTNER",
|
||||
sis_code="UDAYMP2016", industry="SOFTWARE", description="Yes.. Testing Done")
|
||||
self.user = User.objects.create(username='uday')
|
||||
self.user = User.objects.create(username='uday', email='u@mp.com')
|
||||
self.user.set_password('uday2293')
|
||||
self.user.save()
|
||||
self.client.login(username='uday', password='uday2293')
|
||||
|
||||
self.address = Address.objects.create(
|
||||
street="KPHB", city="HYDERABAD", state="ANDHRA PRADESH", postcode="500073", country='IN')
|
||||
self.account = Account.objects.create(
|
||||
name="Uday", email="udayteja@micropyramid.com", phone="8333855552", billing_address=self.address,
|
||||
shipping_address=self.address, website="www.uday.com", created_by=self.user,
|
||||
industry="SOFTWARE", description="Yes.. Testing Done")
|
||||
self.client.login(email='u@mp.com', password='uday2293')
|
||||
|
||||
|
||||
class AccountsCreateUrlTestCase(AccountCreateTest, TestCase):
|
||||
|
|
@ -28,7 +27,7 @@ class AccountsCreateUrlTestCase(AccountCreateTest, TestCase):
|
|||
response = self.client.get('/accounts/create/', {
|
||||
'name': "Uday", 'email': "udayteja@micropyramid.com", 'phone': "", 'billing_address': self.address,
|
||||
'shipping_address': self.address, 'website': "www.uday.com", 'account_type': "PARTNER",
|
||||
'sis_code': "UDAYMP2016", 'industry': "SOFTWARE", 'description': "Yes.. Testing Done"})
|
||||
'industry': "SOFTWARE", 'description': "Yes.. Testing Done"})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_account_create_html(self):
|
||||
|
|
@ -63,7 +62,7 @@ class AccountsViewTestCase(AccountCreateTest, TestCase):
|
|||
self.accounts = Account.objects.all()
|
||||
response = self.client.get('/accounts/1/view/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.context['ac'].id, 1)
|
||||
self.assertEqual(response.context['account_record'].id, 1)
|
||||
self.assertTemplateUsed(response, 'accounts/view_account.html')
|
||||
|
||||
|
||||
|
|
@ -103,4 +102,4 @@ class AccountCreateEmptyFormTestCase(AccountCreateTest, TestCase):
|
|||
data = {'name': "", 'email': "", 'phone': "", 'billing_address': self.address, 'shipping_address': self.address,
|
||||
'website': "", 'account_type': "", 'sis_code': "", 'industry': "", 'description': ""}
|
||||
response = self.client.post('/accounts/create/', data)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
|
@ -3,34 +3,32 @@ from cases.models import Case
|
|||
from contacts.models import Contact
|
||||
from accounts.models import Account
|
||||
from django.test import Client
|
||||
from common.models import Country, Address
|
||||
from common.models import Address
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.contrib.auth.models import User
|
||||
from common.models import User
|
||||
|
||||
|
||||
class CaseCreation(object):
|
||||
def setUp(self):
|
||||
self.country = Country.objects.create(iso_3166_1_a2="IN", iso_3166_1_a3="IN", iso_3166_1_numeric="IN",
|
||||
printable_name="India",
|
||||
name="India", is_shipping_country="True")
|
||||
self.address = Address.objects.create(street="6th phase", city="hyderabad", postcode="506344",
|
||||
country=Country.objects.get(pk=1))
|
||||
country='IN')
|
||||
self.user = User.objects.create(username='raghu', email='r@mp.com')
|
||||
self.user.set_password('raghu')
|
||||
self.user.save()
|
||||
|
||||
self.account = Account.objects.create(name="account", email="account@gmail.com", phone="12345",
|
||||
billing_address=self.address, shipping_address=self.address,
|
||||
website="www.account.com",
|
||||
account_type="account", sis_code="12345", industry="IT",
|
||||
description="account")
|
||||
self.contacts = Contact.objects.create(name="contact",
|
||||
industry="IT",
|
||||
description="account", created_by=self.user)
|
||||
self.contacts = Contact.objects.create(first_name="contact",
|
||||
email="contact@gmail.com", phone="12345",
|
||||
account=self.account, description="contact", address=self.address)
|
||||
account=self.account, description="contact", address=self.address, created_by=self.user)
|
||||
# self.comment = Comments.objects.create(comment="new", caseid=self.case.id, comment_)
|
||||
self.user = User.objects.create(username='raghu')
|
||||
self.user.set_password('raghu')
|
||||
self.user.save()
|
||||
self.client.login(username='raghu', password='raghu')
|
||||
self.client.login(email='r@mp.com', password='raghu')
|
||||
self.case = Case.objects.create(name="raghu", case_type="Problem", status="New", account=self.account,
|
||||
priority="Low", description="something", teams="Sales",
|
||||
userid=User.objects.get(pk=1))
|
||||
created_by=self.user)
|
||||
|
||||
|
||||
class CaseCreateTestCase(CaseCreation, TestCase):
|
||||
|
|
@ -100,4 +98,4 @@ class CaseUpdateTestCase(CaseCreation, TestCase):
|
|||
|
||||
def test_edit_details(self):
|
||||
response = self.client.post('/cases/editdetails/', {'tid': self.case.id})
|
||||
self.assertEqual(int(response.json()['eid']), self.case.id)
|
||||
self.assertEqual(int(response.json()['eid']), self.case.id)
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
from django.test import TestCase
|
||||
from django.test import Client
|
||||
from common.forms import PersonForm
|
||||
from common.models import Person
|
||||
from django.contrib.auth.models import User
|
||||
from common.models import User
|
||||
|
||||
|
||||
class TestHomePage(TestCase):
|
||||
|
|
@ -16,4 +14,4 @@ class TestHomePage(TestCase):
|
|||
response = self.client.get('/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
self.assertIn("Micro", str(response.content))
|
||||
self.assertIn("Micro", str(response.content))
|
||||
|
|
@ -6,7 +6,7 @@ from django.contrib.auth import logout, authenticate, login
|
|||
|
||||
|
||||
|
||||
@login_required
|
||||
#@login_required
|
||||
def home(request):
|
||||
return render(request, 'index.html')
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
from django.test import TestCase
|
||||
from oppurtunity.models import Opportunity
|
||||
from common.models import Country, Address
|
||||
from common.models import Address
|
||||
from accounts.models import Account
|
||||
from contacts.models import Contact
|
||||
from django.contrib.auth.models import User
|
||||
from common.models import User
|
||||
|
||||
|
||||
# Create your tests here.
|
||||
|
|
@ -11,23 +11,21 @@ from django.contrib.auth.models import User
|
|||
|
||||
class OpportunityModel(object):
|
||||
def setUp(self):
|
||||
self.country = Country.objects.create(
|
||||
iso_3166_1_a2="jh", iso_3166_1_a3="nh",
|
||||
iso_3166_1_numeric="gt", printable_name="America",
|
||||
name="India",
|
||||
is_shipping_country="True")
|
||||
self.address = Address.objects.create(
|
||||
street="kphb", city="hyderabad", postcode="584",
|
||||
country=Country.objects.get(pk=1))
|
||||
country='IN')
|
||||
self.user = User.objects.create(username='madhurima')
|
||||
self.user.set_password('madhu123')
|
||||
self.user.save()
|
||||
|
||||
self.account = Account.objects.create(
|
||||
name="uday", email="uday@gmail.com",
|
||||
phone="58964", billing_address=self.address,
|
||||
shipping_address=self.address,
|
||||
website="hello.com",
|
||||
account_type="initial",
|
||||
sis_code="98745", industry="sw", description="bgyyr")
|
||||
industry="sw", description="bgyyr", created_by=self.user)
|
||||
self.contacts = Contact.objects.create(
|
||||
name="navi",
|
||||
first_name="navi",
|
||||
email="navi@gmail.com", phone="8547",
|
||||
account=self.account,
|
||||
description="defyj",
|
||||
|
|
@ -37,9 +35,6 @@ class OpportunityModel(object):
|
|||
stage="negotiation/review", lead_source="Call", probability="58",
|
||||
close_date="2016-05-04",
|
||||
description="hgfdxc")
|
||||
self.user = User.objects.create(username='madhurima')
|
||||
self.user.set_password('madhu123')
|
||||
self.user.save()
|
||||
self.client.login(username='madhurima', password='madhu123')
|
||||
|
||||
|
||||
|
|
@ -84,4 +79,4 @@ class EditOpportunityTestCase(OpportunityModel, TestCase):
|
|||
'stage': "negotiation/review",
|
||||
'lead_source': "Call", 'probability': "58",
|
||||
'close_date': "2016-05-04", 'description': "hgfdxc"})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
|
@ -4,4 +4,4 @@ pytz==2018.3
|
|||
psycopg2==2.7.4
|
||||
gunicorn==19.7.1
|
||||
whitenoise==3.3.1
|
||||
dj-database-url==0.4.2
|
||||
dj-database-url==0.4.2
|
||||
|
|
|
|||
Loading…
Reference in a new issue