Skip to content

Commit

Permalink
update travis file, tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gulliverbms committed Jul 3, 2018
1 parent 3cf2100 commit acc41f3
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 45 deletions.
23 changes: 2 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
language: python
python:
- "3.3"
- "3.4"
- "3.5"
- "3.6"
- "3.5"
env:
- DJANGO_VERSION=2.0
- DJANGO_VERSION=1.11
- DJANGO_VERSION=1.10
- DJANGO_VERSION=1.9
- DJANGO_VERSION=1.8
- DJANGO_VERSION=1.7

install:
- pip install -q Django==$DJANGO_VERSION
- pip install coverage
Expand All @@ -20,17 +15,3 @@ script:
after_success:
- cd example && coverage report
- cd example && coveralls
matrix:
exclude:
- python: "3.3"
env: DJANGO_VERSION=2.0
- python: "3.3"
env: DJANGO_VERSION=1.11
- python: "3.3"
env: DJANGO_VERSION=1.10
- python: "3.3"
env: DJANGO_VERSION=1.9
- python: "3.5"
env: DJANGO_VERSION=1.7
- python: "3.6"
env: DJANGO_VERSION=1.7
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

0.0.7 (2018-03-07)
---------------------------------
- Added multiple choice of templates.
- Added unit tests.
- Changed the template "change_form.html"

0.0.6.1 (2018-14-06)
---------------------------------
- Fixed validate parameter.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ "TEST"|lower }}
2 changes: 2 additions & 0 deletions django_grapesjs/tests/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ def test_init(self):
incorrect_value = 'string'

formfield = GrapesJsField()

self.assertSetEqual(
set(GrapesJsField.__init__.__defaults__),
set(self.get_check_dict_attr(None, {}, formfield).values())
)

data = self.get_check_dict_attr(incorrect_value, {}, None)
formfield = GrapesJsField(**data)

self.assertSetEqual(
set(data.values()),
set(self.get_check_dict_attr(None, {}, formfield).values())
Expand Down
17 changes: 3 additions & 14 deletions django_grapesjs/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,14 @@


class GetRenderHtmlValueTestCase(test.TestCase):
name_file = 'test.html'
path_file = './app/templates/%s'

def create_template(self, value):
f = open(self.path_file % self.name_file, 'w')
f.write(value)
f.close()

def delete_template(self):
os.remove(self.path_file % self.name_file)
template_name = 'django_grapesjs/tests/get_render_html_value.html'

def test_get_render_html_value_correct(self):
value = '{{ "TEST"|lower }}'
result = 'test'

self.create_template(value)
self.assertEqual(value, get_render_html_value(self.name_file, apply_django_tag=False)())
self.assertEqual(result, get_render_html_value(self.name_file, apply_django_tag=True)())
self.delete_template()
self.assertEqual(value, get_render_html_value(self.template_name, apply_django_tag=False)())
self.assertEqual(result, get_render_html_value(self.template_name, apply_django_tag=True)())

def test_get_render_html_value_incorrect(self):
with self.assertRaises(TemplateDoesNotExist):
Expand Down
21 changes: 16 additions & 5 deletions example/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,21 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django_grapesjs.views import GetTemplate

urlpatterns = [
path('admin/', admin.site.urls),
path('get_template/', GetTemplate.as_view(), name='dgjs_get_template'),
]

try:
from django.urls import path

urlpatterns = [
path('admin/', admin.site.urls),
path('get_template/', GetTemplate.as_view(), name='dgjs_get_template'),
]

except ImportError:
from django.conf.urls import include, url

urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^get_template/', GetTemplate.as_view(), name='dgjs_get_template'),
]
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
django>=1.9
django>=1.11
4 changes: 0 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ def read(fname):
"Framework :: Django :: 2.0",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Environment :: Web Environment",
Expand Down

0 comments on commit acc41f3

Please sign in to comment.