From ef6e61222554df5defe6f1882c0290310c0a2429 Mon Sep 17 00:00:00 2001 From: KingCSharp Date: Fri, 20 Jul 2018 13:23:59 +0530 Subject: [PATCH] updated codacy changes --- .coverage | 2 +- .gitignore | 2 +- .travis.yml | 2 + README.rst | 24 ++-- accounts/tests.py | 5 +- crm/settings.py | 6 +- leads/tests.py | 32 +++--- manage.py | 1 + pytest.ini | 4 + requirements.txt | 1 + view-pages.html | 277 ---------------------------------------------- 11 files changed, 43 insertions(+), 313 deletions(-) create mode 100644 pytest.ini delete mode 100644 view-pages.html diff --git a/.coverage b/.coverage index 1f5b650..80d534d 100644 --- a/.coverage +++ b/.coverage @@ -1 +1 @@ -!coverage.py: This is a private format, don't read it directly!{"lines":{"/home/nikhila/mp_projs/django_crm/django_crm/common/__init__.py":[1],"/home/nikhila/mp_projs/django_crm/django_crm/common/urls.py":[1,2,3,5,9,10],"/home/nikhila/mp_projs/django_crm/django_crm/common/migrations/0001_initial.py":[3,5,6,7,8,11,13,16,17,21,22,24,25,26,27,28,29,30,31,32,33,36,39,42,43,45,46,47,48,49,50,51,54,55,57,58,59,60,61,62,65,66,68,69,70,71,74,75,77,78,79],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/apps.py":[],"/home/nikhila/mp_projs/django_crm/django_crm/common/views.py":[1,2,3,4,5,10,11,14],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/__init__.py":[1],"/home/nikhila/mp_projs/django_crm/django_crm/common/apps.py":[],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/models.py":[1,2,3,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22,24],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/views.py":[1,2,3,4,5,6,7,8,9,10,11,12,18,19,21,22,23,24,260,27,29,32,35,36,37,38,42,43,45,46,47,48,49,50,51,52,53,54,55,56,71,72,73,74,75,76,77,78,79,80,84,85,86,87,88,89,90,91,92,93,97,98,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,125,126,128,129,130,131,132,133,134,135,136,137,138,25,171,172,173,174,175,176,177,178,179,180,181,182,183,187,188,190,191,192,198,221,242],"/home/nikhila/mp_projs/django_crm/django_crm/common/tests.py":[1,2,3,6,7,8,9,10,11,13,14,15,16,17],"/home/nikhila/mp_projs/django_crm/django_crm/common/migrations/0002_auto_20170926_1752.py":[3,5,6,9,11,14,15,16,17,18,22,23,24,25,27,28,29,30,32,33,34,35,37,38,39,40,42,43,44,45],"/home/nikhila/mp_projs/django_crm/django_crm/common/models.py":[1,2,3,5,8,9,10,11,12,13,14,16,17,19,21,24,28,29,30,31,32,33,34,36,37,40,41,42,44,48,49,50,51,52,53,54,55,56,57,58,59,61,65,66,67,68,70],"/home/nikhila/mp_projs/django_crm/django_crm/common/migrations/__init__.py":[1],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/migrations/__init__.py":[1],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/forms.py":[1,2,3,6,8,9,10,11,12,13,14,15,16,17,19,20,22,24,37,38,40,41,42],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/tests.py":[1,2,3,4,10,11,12,13,14,16,17,18,19,20,21,22,25,26,27,28,29,30,31,33,34,35,36,37,38,41,42,43,46,47,48,49,50,51,54,55,56,57,60,61,62,63,64,65,66,69,70,72,73,75,76,77,78,81,82,83,84,85,86,87,88,90,91,92,94,99,101,102,103,104,105],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/admin.py":[1,2,6],"/home/nikhila/mp_projs/django_crm/django_crm/common/utils.py":[1,34,41,49,60,69,76,82,94,106,113,124,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/migrations/0002_auto_20170926_1752.py":[3,5,6,7,10,12,15,16,17,21,22,23,24,26,27,28,29,31,32,33,34,36,37,38,39,41,42,43,44],"/home/nikhila/mp_projs/django_crm/django_crm/common/admin.py":[1,2,5,6,7,8,9],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/urls.py":[1,2,4,8,9,10,11,12,13,15,16,17],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/migrations/0001_initial.py":[3,5,8,10,12,16,17,19,20,21,22,23,24,25,26,27],"/home/nikhila/mp_projs/django_crm/django_crm/common/forms.py":[1,2,3,4,5,6,7,10,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,33,34,35,36,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52]}} \ No newline at end of file +!coverage.py: This is a private format, don't read it directly!{"lines":{"/home/nikhila/mp_projs/django_crm/django_crm/accounts/urls.py":[16,1,2,4,8,9,10,11,12,14,15],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/views.py":[1,2,3,4,5,6,7,8,9,10,11,14,16,17,18,19,20,22,24,27,30,31,32,33,37,39,40,41,42,43,44,45,46,47,48,49,50,65,66,67,68,69,70,71,72,73,74,78,79,80,81,82,83,84,85,86,87,91,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,118,120,121,122,123,124,125,126,127,128,129,130,163,164,165,166,167,168,169,170,171,172,173,174,175,179,181,182,183,186,209,230],"/home/nikhila/mp_projs/django_crm/django_crm/common/tests.py":[1,2,3,6,7,8,9,10,11,12,15,16,17,18,19,20],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/models.py":[1,2,3,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22,24,27,28],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/migrations/0003_auto_20180410_1412.py":[3,6,9,13,14,15],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/migrations/__init__.py":[1],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/migrations/0002_auto_20170926_1752.py":[3,5,6,7,10,12,15,16,17,21,22,23,24,26,27,28,29,31,32,33,34,36,37,38,39,41,42,43,44],"/home/nikhila/mp_projs/django_crm/django_crm/common/views.py":[1,2,3,4,5,6,8,9,12,130,14,79,83,142,23,89,26,156,31,28,113,52,59],"/home/nikhila/mp_projs/django_crm/django_crm/common/apps.py":[],"/home/nikhila/mp_projs/django_crm/django_crm/common/forms.py":[1,2,4,7,9,10,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,30,31,32,33,35,36,37,38,39,129,41,42,43,44,45,46,47,48,49,52,54,56,57,58,60,70,78,95,96,97,99,100,101,103,107,40,121,122,123,124,126],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/apps.py":[],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/tests.py":[1,2,3,7,8,9,10,11,13,14,15,16,17,18,19,22,23,24,25,26,27,28,30,31,32,33,34,35,38,39,40,41,42,43,46,47,48,49,52,53,54,55,56,57,60,61,62,63,65,66,67,68,71,72,73,74,75,76,77,78,80,81,82,84,89,91,92,93,94,95],"/home/nikhila/mp_projs/django_crm/django_crm/common/migrations/__init__.py":[1],"/home/nikhila/mp_projs/django_crm/django_crm/common/__init__.py":[1],"/home/nikhila/mp_projs/django_crm/django_crm/common/migrations/0003_user_role.py":[16,17,3,6,9,13,14,15],"/home/nikhila/mp_projs/django_crm/django_crm/common/utils.py":[1,34,41,46,54,65,74,81,87,99,111,118,129,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539],"/home/nikhila/mp_projs/django_crm/django_crm/common/migrations/0002_auto_20170926_1752.py":[3,5,6,9,11,14,15,16,17,18,22,23,24,25,27,28,29,30,32,33,34,35,37,38,39,40,42,43,44,45],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/migrations/0001_initial.py":[3,5,8,10,12,16,17,19,20,21,22,23,24,25,26,27],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/__init__.py":[1],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/forms.py":[1,2,3,6,8,9,10,11,12,13,14,15,16,17,19,20,22,24,37,38,40,41,42],"/home/nikhila/mp_projs/django_crm/django_crm/accounts/admin.py":[],"/home/nikhila/mp_projs/django_crm/django_crm/common/models.py":[1,2,3,5,8,9,10,11,12,13,14,15,16,17,19,20,22,24,27,31,32,33,34,35,36,37,39,40,43,44,45,47,51,52,53,54,55,56,57,58,59,60,61,62,64,68,69,70,71,73],"/home/nikhila/mp_projs/django_crm/django_crm/common/migrations/0001_initial.py":[3,5,6,7,8,11,13,16,17,21,22,24,25,26,27,28,29,30,31,32,33,34,35,38,41,44,45,47,48,49,50,51,52,53,56,57,59,60,61,62,63,64,67,68,70,71,72,73,76,77,79,80,81],"/home/nikhila/mp_projs/django_crm/django_crm/common/urls.py":[1,2,3,5,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],"/home/nikhila/mp_projs/django_crm/django_crm/common/admin.py":[]}} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7580205..a97dca3 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ main.css main.css.map ref.css ref.css.map - +.coverage diff --git a/.travis.yml b/.travis.yml index 600492a..94d1e5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,8 @@ install: script: - python manage.py test - coverage run --source=accounts,common manage.py test accounts common + - pytest --cov=koalixcrm --cov-report xml --cov-report term + - python-codacy-coverage -r coverage.xml after_success: coveralls diff --git a/README.rst b/README.rst index 538787f..7641f80 100644 --- a/README.rst +++ b/README.rst @@ -1,16 +1,9 @@ Django-CRM ========== -.. image:: https://api.codacy.com/project/badge/Grade/b11da5f09dd542479fd3bd53944595d2 - :alt: Codacy Badge - :target: https://app.codacy.com/app/ashwin/Django-CRM?utm_source=github.com&utm_medium=referral&utm_content=MicroPyramid/Django-CRM&utm_campaign=badger - Django CRM is opensourse CRM developed on django framework. It has all the basic features of CRM to start with. We welcome code contributions and feature requests via github. -.. image:: https://travis-ci.org/MicroPyramid/Django-CRM.svg?branch=master - :target: https://travis-ci.org/MicroPyramid/Django-CRM - .. image:: https://coveralls.io/repos/github/MicroPyramid/Django-CRM/badge.svg?branch=master :target: https://coveralls.io/github/MicroPyramid/Django-CRM?branch=master @@ -21,8 +14,20 @@ Django CRM is opensourse CRM developed on django framework. It has all the basic .. image:: https://img.shields.io/github/license/MicroPyramid/Django-CRM.svg :target: https://pypi.python.org/pypi/Django-CRM/ -.. image:: https://www.codetriage.com/micropyramid/django-crm/badges/users.svg - :target: https://www.codetriage.com/micropyramid/django-crm +.. list-table:: + :header-rows: 1 + :widths: 7 7 7 60 + :stub-columns: 1 + + * - Build Status + - Codacy + - Support + * - .. image:: https://travis-ci.org/MicroPyramid/Django-CRM.svg?branch=master + - .. image:: https://api.codacy.com/project/badge/Grade/b11da5f09dd542479fd3bd53944595d2 + .. image:: https://api.codacy.com/project/badge/Coverage/b11da5f09dd542479fd3bd53944595d2 + - .. image:: https://badges.gitter.im/Micropyramid/Django-CRM.png + .. image:: https://www.codetriage.com/micropyramid/django-crm/badges/users.svg + http://django-crm.readthedocs.io for latest documentation @@ -72,4 +77,3 @@ Need additional commercial support? `Contact us here`_ .. _contact us here: https://micropyramid.com/contact-us/ .. _here: https://django-crm.micropyramid.com/ - diff --git a/accounts/tests.py b/accounts/tests.py index 169d1b3..9d1ab20 100644 --- a/accounts/tests.py +++ b/accounts/tests.py @@ -1,12 +1,9 @@ from django.test import TestCase -from common.models import * from accounts.models import Account -from common.models import User +from common.models import User, Address # Create your tests here. - - class AccountCreateTest(object): def setUp(self): self.user = User.objects.create(first_name="uday", username='uday', email='u@mp.com', role='ADMIN') diff --git a/crm/settings.py b/crm/settings.py index 41b02fe..dbdd737 100644 --- a/crm/settings.py +++ b/crm/settings.py @@ -27,6 +27,8 @@ 'django.contrib.messages', 'django.contrib.sessions', 'django.contrib.staticfiles', + 'simple_pagination', + 'compressor', 'common', 'accounts', 'cases', @@ -35,13 +37,9 @@ 'leads', 'opportunity', 'planner', - 'simple_pagination', - 'compressor' - ] - MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.middleware.common.CommonMiddleware', diff --git a/leads/tests.py b/leads/tests.py index a5e2384..4da1255 100644 --- a/leads/tests.py +++ b/leads/tests.py @@ -42,22 +42,22 @@ def setUp(self): opportunity_amount="700", description="Iam an Lead", created_by=self.user) - - def testaddress_post_object_creation(self): - c = Address.objects.count() - self.assertEqual(c, 1) - - def test_get_addressobject_with_name(self): - p = Address.objects.get(state="Telangana") - self.assertEqual(p.street, "Gokul enclave colony") - - def test_lead_object_creation(self): - c = Lead.objects.count() - self.assertEqual(c, 1) - - def test_get_leadobjects_with_name(self): - p = Lead.objects.get(title="LeadCreation") - self.assertEqual(p.account.name, "account") + # @pytest.mark.django_db(transaction=True) + # def testaddress_post_object_creation(self): + # c = Address.objects.count() + # self.assertEqual(c, 1) + + # def test_get_addressobject_with_name(self): + # p = Address.objects.get(state="Telangana") + # self.assertEqual(p.street, "Gokul enclave colony") + + # def test_lead_object_creation(self): + # c = Lead.objects.count() + # self.assertEqual(c, 1) + + # def test_get_leadobjects_with_name(self): + # p = Lead.objects.get(title="LeadCreation") + # self.assertEqual(p.account.name, "account") class LeadsPostrequestTestCase(TestLeadModel, TestCase): diff --git a/manage.py b/manage.py index 38f8f81..c03e12d 100755 --- a/manage.py +++ b/manage.py @@ -4,6 +4,7 @@ if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "crm.settings") + os.environ['DJANGO_SETTINGS_MODULE'] = "crm.settings" try: from django.core.management import execute_from_command_line except ImportError: diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..4455c1e --- /dev/null +++ b/pytest.ini @@ -0,0 +1,4 @@ +[pytest] +DJANGO_SETTINGS_MODULE=crm.settings +python_files = tests.py test_*.py *_tests.py + diff --git a/requirements.txt b/requirements.txt index ea5763a..dabc402 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ psycopg2-binary==2.7.4 redis django-compressor==2.2 coverage +codacy-coverage==1.3.11 diff --git a/view-pages.html b/view-pages.html deleted file mode 100644 index 973e944..0000000 --- a/view-pages.html +++ /dev/null @@ -1,277 +0,0 @@ -opportunity - - -
-
- -
-
-
Label
-
-
-
-
- {%if opportunity_record.assigned_to.all %} - -
- {% for user in opportunity_record.assigned_to.all %} -
  • {{ user }}
  • - {% endfor %} -
    - {% endif %} -
    -
    - -
    -
    - -
    {{opportunity_record.created_on}}
    -
    -
    -
    -
    - -
    {{opportunity_record.created_by}}
    -
    -
    -
    -
    -
    -
    - - - - - - Account - - - -
    -
    -
    -
    -
    Label
    -
    -
    -
    -
    - {%if account_record.assigned_to.all %} - - - {% endif %} -
    -
    -
    -
    - - -
    -
    -
    -
    - - -
    -
    -
    -
    -
    -
    - - - contacts - - -
    -
    - -
    -
    -
    Label
    -
    -
    -
    -
    - {%if contact_record.assigned_to.all %} - -
    - {% for user in contact_record.assigned_to.all %} -
  • {{ user }}
  • - {% endfor %} -
    - {% endif %} -
    -
    - -
    -
    - -
    - {{ contact_record.created_on }} -
    -
    -
    -
    -
    - -
    - {{ contact_record.created_by }} -
    -
    -
    -
    -
    -
    -
    - - - leads - - -
    -
    - -
    -
    -
    Label
    -
    -
    -
    -
    - {%if lead_record.assigned_to.all %} - -
    - {% for user in lead_record.assigned_to.all %} -
  • {{ user }}
  • - {% endfor %} -
    - {% endif %} -
    -
    - -
    -
    - -
    - {{lead_record.created_on}} -
    -
    -
    -
    -
    - -
    - {{lead_record.created_by}} -
    -
    -
    -
    -
    -
    -
    - - - cases - -
    -
    - -
    -
    -
    Label
    -
    -
    -
    -
    - {% if case_record.assigned_to.all %} - -
    - {% for user in case_record.assigned_to.all %} -
  • {{ user }}
  • - {% endfor %} -
    - {% endif %} -
    -
    - -
    -
    - -
    - {{ case_record.created_on }} -
    -
    -
    -
    -
    - -
    - {{ case_record.created_by }} -
    -
    -
    -
    -
    -
    -
    \ No newline at end of file