Skip to content

Commit 0fcc210

Browse files
authored
Merge pull request #43 from edx/awais786/BOM-1018
BOM-1018
2 parents 161ac11 + 6aa5a2f commit 0fcc210

File tree

18 files changed

+227
-141
lines changed

18 files changed

+227
-141
lines changed

.travis.yml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,58 @@
11
language: python
22
python:
33
- 2.7
4+
- 3.5
45
- 3.6
56
env:
67
- TOXENV=django111-drf37
78
- TOXENV=django111-drf38
89
- TOXENV=django111-drf39
910
- TOXENV=django111-drflatest
11+
- TOXENV=django20-drf37
12+
- TOXENV=django20-drf38
13+
- TOXENV=django20-drf39
14+
- TOXENV=django20-drflatest
15+
- TOXENV=django21-drf37
16+
- TOXENV=django21-drf38
17+
- TOXENV=django21-drf39
18+
- TOXENV=django21-drflatest
19+
- TOXENV=django22-drf37
20+
- TOXENV=django22-drf38
21+
- TOXENV=django22-drf39
22+
- TOXENV=django22-drflatest
23+
1024
matrix:
25+
exclude:
26+
- python: 2.7
27+
env: TOXENV=django20-drf37
28+
- python: 2.7
29+
env: TOXENV=django20-drf38
30+
- python: 2.7
31+
env: TOXENV=django20-drf39
32+
- python: 2.7
33+
env: TOXENV=django20-drflatest
34+
- python: 2.7
35+
env: TOXENV=django21-drf37
36+
- python: 2.7
37+
env: TOXENV=django21-drf38
38+
- python: 2.7
39+
env: TOXENV=django21-drf39
40+
- python: 2.7
41+
env: TOXENV=django21-drflatest
42+
- python: 2.7
43+
env: TOXENV=django22-drf37
44+
- python: 2.7
45+
env: TOXENV=django22-drf38
46+
- python: 2.7
47+
env: TOXENV=django22-drf39
48+
- python: 2.7
49+
env: TOXENV=django22-drflatest
50+
51+
1152
include:
12-
- python: 3.6
53+
- python: 3.5
1354
env: TOXENV=quality
14-
- python: 3.6
55+
- python: 3.5
1556
env: TOXENV=docs
1657
- python: 2.7
1758
env: TOXENV=quality

config_models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
from __future__ import absolute_import, unicode_literals
66

7-
__version__ = '1.0.1'
7+
__version__ = '1.0.2'
88

99
default_app_config = 'config_models.apps.ConfigModelsConfig' # pylint: disable=invalid-name

config_models/admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from django.contrib.admin import ListFilter
99
from django.core.cache import caches, InvalidCacheBackendError
1010
from django.core.files.base import File
11-
from django.core.urlresolvers import reverse
11+
from django.urls import reverse
1212
from django.http import HttpResponseRedirect
1313
from django.shortcuts import get_object_or_404
1414
from django.utils.translation import ugettext_lazy as _
@@ -92,7 +92,7 @@ def revert(self, request, queryset):
9292
"""
9393
if queryset.count() != 1:
9494
self.message_user(request, _("Please select a single configuration to revert to."))
95-
return
95+
return None
9696

9797
target = queryset[0]
9898
target.id = None

config_models/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def current(cls, *args):
146146

147147
key_dict = dict(zip(cls.KEY_FIELDS, args))
148148
try:
149-
current = cls.objects.filter(**key_dict).order_by('-change_date')[0]
149+
current = cls.objects.filter(**key_dict).order_by('-change_date')[0] # pylint: disable=no-member
150150
except IndexError:
151151
current = cls(**key_dict)
152152

config_models/templatetags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ def submit_row(context):
2626
'show_save_and_continue': False,
2727
'show_save': False,
2828
})
29-
else:
30-
return ctx
29+
30+
return ctx

config_models/tests/test_admin.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
ConfigurationModel Admin Module Test Cases
3+
"""
4+
5+
from __future__ import unicode_literals
6+
7+
from django.contrib.admin.sites import AdminSite
8+
from django.contrib.messages.storage.fallback import FallbackStorage
9+
from django.http import HttpRequest
10+
from django.test import TestCase
11+
12+
from config_models.admin import ConfigurationModelAdmin
13+
from config_models.models import ConfigurationModel
14+
15+
16+
class AdminTestCase(TestCase):
17+
"""
18+
Test Case module for ConfigurationModel Admin
19+
"""
20+
def setUp(self):
21+
super(AdminTestCase, self).setUp()
22+
self.request = HttpRequest()
23+
self.conf_admin = ConfigurationModelAdmin(ConfigurationModel, AdminSite())
24+
self.request.session = 'session'
25+
self.request._messages = FallbackStorage(self.request) # pylint: disable=protected-access
26+
27+
def test_default_fields(self):
28+
"""
29+
Test: checking fields
30+
"""
31+
self.assertEqual(
32+
list(self.conf_admin.get_form(self.request).base_fields),
33+
['enabled']
34+
)

config_models/tests/test_config_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class ExampleKeyedConfig(ConfigurationModel):
214214

215215
left = models.CharField(max_length=30)
216216
right = models.CharField(max_length=30)
217-
user = models.ForeignKey('auth.User')
217+
user = models.ForeignKey('auth.User', on_delete=models.CASCADE)
218218

219219
string_field = models.TextField()
220220
int_field = models.IntegerField(default=10)

config_models/tests/test_decorators.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
Tests for config models decorators
33
"""
44

5-
from __future__ import unicode_literals, absolute_import
5+
from __future__ import absolute_import, unicode_literals
6+
from django.utils import six
67

78
from config_models import decorators
89
from config_models.models import ConfigurationModel
910
from config_models.tests.utils import CacheIsolationTestCase
10-
from django.utils import six
11-
1211

1312
# pylint: disable=model-missing-unicode
1413
@six.python_2_unicode_compatible

requirements/base.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
#
55
# make upgrade
66
#
7-
django==1.11.22
7+
django==1.11.26
88
djangorestframework==3.9.4
9-
pytz==2019.1 # via django
9+
pytz==2019.3 # via django

requirements/dev.txt

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,73 +5,71 @@
55
# make upgrade
66
#
77
argparse==1.4.0
8-
astroid==1.5.3
8+
astroid==1.6.6
99
atomicwrites==1.3.0
10-
attrs==19.1.0
11-
backports.functools-lru-cache==1.5
12-
backports.os==0.1.1 # via path.py
13-
caniusepython3==7.1.0
14-
certifi==2019.6.16
10+
attrs==19.3.0
11+
backports.functools-lru-cache==1.6.1
12+
caniusepython3==7.2.0
13+
certifi==2019.9.11
1514
chardet==3.0.4
1615
click-log==0.3.2
1716
click==7.0
1817
codecov==2.0.15
19-
configparser==3.7.4
20-
contextlib2==0.5.5
21-
coverage==4.5.3
18+
configparser==4.0.2
19+
contextlib2==0.6.0.post1
20+
coverage==4.5.4
2221
ddt==1.2.1
23-
distlib==0.2.9.post0
24-
django==1.11.22
22+
distlib==0.3.0
23+
django==1.11.26
2524
djangorestframework==3.9.4
2625
edx-i18n-tools==0.4.8
27-
edx-lint==1.3.0
26+
edx-lint==1.4.1
2827
enum34==1.1.6
2928
filelock==3.0.12
3029
freezegun==0.3.12
3130
funcsigs==1.0.2
32-
future==0.17.1 # via backports.os
3331
futures==3.2.0 ; python_version == "2.7"
3432
idna==2.8
35-
importlib-metadata==0.18
33+
importlib-metadata==0.23
3634
isort==4.3.21
37-
lazy-object-proxy==1.4.1
35+
lazy-object-proxy==1.4.3
3836
mccabe==0.6.1
3937
mock==3.0.5
4038
more-itertools==5.0.0
41-
packaging==19.0
39+
packaging==19.2
4240
path.py==11.5.2 # via edx-i18n-tools
43-
pathlib2==2.3.4
44-
pip-tools==3.8.0
45-
pluggy==0.12.0
41+
pathlib2==2.3.5
42+
pip-tools==4.2.0
43+
pluggy==0.13.0
4644
polib==1.1.0 # via edx-i18n-tools
4745
py==1.8.0
4846
pycodestyle==2.5.0
4947
pydocstyle==3.0.0
5048
pylint-celery==0.3
51-
pylint-django==0.7.2
52-
pylint-plugin-utils==0.5
53-
pylint==1.7.6
54-
pyparsing==2.4.0
55-
pytest-cov==2.7.1
56-
pytest-django==3.5.1
57-
pytest==4.6.4
58-
python-dateutil==2.8.0
59-
pytz==2019.1
60-
pyyaml==5.1.1 # via edx-i18n-tools
49+
pylint-django==0.11.1
50+
pylint-plugin-utils==0.6
51+
pylint==1.9.5
52+
pyparsing==2.4.4
53+
pytest-cov==2.8.1
54+
pytest-django==3.6.0
55+
pytest==4.6.6
56+
python-dateutil==2.8.1
57+
pytz==2019.3
58+
pyyaml==5.1.2 # via edx-i18n-tools
6159
requests==2.22.0
6260
scandir==1.10.0
6361
singledispatch==3.4.0.3
64-
six==1.12.0
65-
snowballstemmer==1.9.0
62+
six==1.13.0
63+
snowballstemmer==2.0.0
6664
toml==0.10.0
6765
tox-battery==0.5.1
6866
tox-travis==0.12
69-
tox==3.13.2
70-
urllib3==1.25.3
71-
virtualenv==16.6.1
67+
tox==3.14.0
68+
urllib3==1.25.6
69+
virtualenv==16.7.7
7270
wcwidth==0.1.7
7371
wrapt==1.11.2
74-
zipp==0.5.1
72+
zipp==0.6.0
7573

7674
# The following packages are considered to be unsafe in a requirements file:
77-
# setuptools==41.0.1 # via caniusepython3
75+
# setuptools==41.6.0 # via caniusepython3

0 commit comments

Comments
 (0)