Skip to content
This repository was archived by the owner on Dec 7, 2023. It is now read-only.

Commit 5298d6d

Browse files
authored
Merge pull request #24 from dipcode-software/feat/tests-evolution
now tests with various versions of python and django
2 parents 2623c6d + 1fdc0f3 commit 5298d6d

File tree

9 files changed

+90
-47
lines changed

9 files changed

+90
-47
lines changed

.travis.yml

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,46 @@
1+
sudo: false
12
language: python
3+
24
python:
3-
- 2.7
4-
sudo: false
5+
- "2.7"
6+
- "3.4"
7+
- "3.5"
8+
- "3.6"
9+
10+
env:
11+
matrix:
12+
- django19
13+
- django110
14+
- django111
15+
- djangomaster
16+
17+
matrix:
18+
fast_finish: true
19+
include:
20+
- python: "3.4"
21+
env: flake8
22+
exclude:
23+
- python: "2.7"
24+
env: djangomaster
25+
- python: "3.6"
26+
env: django19
27+
- python: "3.6"
28+
env: django111
29+
allow_failures:
30+
- env: djangomaster
31+
32+
cache:
33+
directories:
34+
- $HOME/.cache/pip
35+
- $TRAVIS_BUILD_DIR/.tox
36+
537
install:
6-
- pip install tox
38+
- pip install --upgrade pip wheel setuptools
39+
- pip install coveralls codacy-coverage tox-travis
40+
741
script:
8-
- tox -e flake8
9-
- tox -e travis
42+
- tox
43+
44+
after_success:
45+
- coveralls
46+
- python-codacy-coverage -r coverage.xml

AUTHORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
We'd like to thank the following people for their contributions.
44

5-
- Paulo Truta <jpt@eurotux.com>
65
- Sandro Rodrigues <srtabs@gmail.com>
76
- Tiago Brito <tfb@eurotux.com>
87
- Tiago Loureiro <tiagocostaloureiro@gmail.com>
8+
- Paulo Truta

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7-
## 0.1.0 - 2017-09-13
7+
## [0.1.1] - 2017-09-13
8+
### Added
9+
- Support to python 3.4, 3.5 and 3.6 and django 1.9, 1.10 and 1.11.
10+
11+
## [0.1.0] - 2017-09-13
812
- First release on PyPi

MANIFEST.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
include AUTHORS.md
2+
include CHANGELOG.md
3+
include CODE_OF_CONDUCT.md
14
include LICENSE
2-
include README.md
5+
include MANIFEST.in
6+
include README.rst
37
recursive-include ajax_cbv/static *

README.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
Django Ajax CBV
22
=================
33

4-
|Build Status| |Codacy Badge| |Coverage Status| |BCH compliance|
4+
|Build Status| |Codacy Badge| |Coverage Status| |BCH compliance| |Pypi|
55

66
Django module to easily use generic Class Based views with ajax.
77

88
Table of contents:
99
* `How to install`_;
1010
* `License`_.
1111

12+
Compatibility
13+
-------------
14+
Django
15+
* 1.10
16+
* 1.11
17+
* latest
18+
1219
How to install
1320
--------------
1421

@@ -38,11 +45,13 @@ projects and commercial products.
3845
.. _How to install: #how-to-install
3946
.. _License: #license
4047

41-
.. |Build Status| image:: https://travis-ci.org/dipcode-software/django-ajax-views.svg?branch=master
48+
.. |Build Status| image:: https://travis-ci.org/dipcode-software/django-ajax-cbv.svg?branch=master
4249
:target: https://travis-ci.org/dipcode-software/django-ajax-cbv
4350
.. |Codacy Badge| image:: https://api.codacy.com/project/badge/Grade/a64f03c2bd344561bc21e05c23aa04fb
4451
:target: https://www.codacy.com/app/srtabs/django-ajax-cbv?utm_source=github.com&utm_medium=referral&utm_content=dipcode-software/django-ajax-cbv&utm_campaign=Badge_Grade
4552
.. |Coverage Status| image:: https://coveralls.io/repos/github/dipcode-software/django-ajax-cbv/badge.svg?branch=master
4653
:target: https://coveralls.io/github/dipcode-software/django-ajax-cbv?branch=master
4754
.. |BCH compliance| image:: https://bettercodehub.com/edge/badge/dipcode-software/django-ajax-cbv?branch=master
4855
:target: https://bettercodehub.com/
56+
.. |Pypi| image:: https://img.shields.io/pypi/v/django-ajax-cbv.svg?style=flat-square
57+
:target: https://pypi.python.org/pypi/django-ajax-cbv

ajax_cbv/__init__.py

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

55
default_app_config = 'ajax_cbv.apps.AjaxCBVConfig'
66

7-
__version__ = '0.1.0'
7+
__version__ = '0.1.1'

ajax_cbv/tests/test_mixins.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ def setUp(self):
2727

2828
def test_response_no_action(self):
2929
response = self.object.json_to_response()
30-
content = json.loads(response.content)
30+
content = json.loads(response.content.decode("utf-8"))
3131
self.assertEqual(response.status_code, 200)
3232
self.assertEqual(content['action'], "nothing")
3333
self.assertEqual(content['status'], AjaxResponseStatus.SUCCESS)
3434

3535
def test_response_with_action_refresh(self):
3636
response = self.object.json_to_response(
3737
action=AjaxResponseAction.REFRESH)
38-
content = json.loads(response.content)
38+
content = json.loads(response.content.decode("utf-8"))
3939
self.assertEqual(response.status_code, 200)
4040
self.assertEqual(content['action'], "refresh")
4141
self.assertEqual(content['status'], AjaxResponseStatus.SUCCESS)
@@ -44,7 +44,7 @@ def test_response_with_action_redirect(self):
4444
response = self.object.json_to_response(
4545
action=AjaxResponseAction.REDIRECT,
4646
success_url="/unit/test")
47-
content = json.loads(response.content)
47+
content = json.loads(response.content.decode("utf-8"))
4848
self.assertEqual(response.status_code, 200)
4949
self.assertEqual(content['action'], "redirect")
5050
self.assertEqual(content['status'], AjaxResponseStatus.SUCCESS)
@@ -87,7 +87,7 @@ def test_form_invalid_no_ajax(self):
8787
def test_form_invalid_as_ajax(self):
8888
self.view.request.is_ajax.return_value = True
8989
response = self.view.form_invalid(self.form)
90-
content = json.loads(response.content)
90+
content = json.loads(response.content.decode("utf-8"))
9191
self.assertEqual(response.status_code, 400)
9292
self.assertEqual(content['action'], "nothing")
9393
self.assertEqual(content['status'], AjaxResponseStatus.ERROR)
@@ -100,7 +100,7 @@ def test_form_valid_no_ajax(self):
100100
def test_form_valid_as_ajax(self):
101101
self.view.request.is_ajax.return_value = True
102102
response = self.view.form_valid(self.form)
103-
content = json.loads(response.content)
103+
content = json.loads(response.content.decode("utf-8"))
104104
self.assertEqual(response.status_code, 200)
105105
self.assertEqual(content['action'], "nothing")
106106
self.assertEqual(content['status'], AjaxResponseStatus.SUCCESS)
@@ -159,7 +159,7 @@ def test_get_context_data_without_partial_title(self):
159159
return_value="<html></html>")
160160
def test_render_to_response(self, render_to_string):
161161
result = self.view.render_to_response({})
162-
content = json.loads(result.content)
162+
content = json.loads(result.content.decode("utf-8"))
163163
self.assertEqual(content['content'], "<html></html>")
164164
render_to_string.assert_called_with(
165165
"example.html", {}, request=self.view.request)

setup.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,17 @@ class DevelopmentPublishCommand(PublishCommand):
8383
classifiers=[
8484
'Environment :: Web Environment',
8585
'Framework :: Django',
86+
'Framework :: Django :: 1.9',
87+
'Framework :: Django :: 1.10',
8688
'Framework :: Django :: 1.11',
8789
'Intended Audience :: Developers',
8890
'License :: OSI Approved :: MIT License',
8991
'Operating System :: OS Independent',
9092
'Programming Language :: Python',
9193
'Programming Language :: Python :: 2.7',
94+
'Programming Language :: Python :: 3.4',
95+
'Programming Language :: Python :: 3.5',
96+
'Programming Language :: Python :: 3.6',
9297
],
9398
cmdclass={
9499
'publish_dev': DevelopmentPublishCommand,

tox.ini

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,23 @@
11
[tox]
22
skipsdist = True
3-
envlist = py27,flake8
3+
envlist =
4+
py{27,34,35}-django{19,110,111},
5+
py{35,36}-django{111,master}
6+
flake8
47

58
[testenv]
6-
deps = -r{toxinidir}/requirements/tests.txt
7-
commands = {envpython} runtests.py
8-
9-
[testenv:flake8]
10-
deps = flake8
11-
commands = flake8 {toxinidir}/ajax_cbv --exclude=*/migrations/*
12-
13-
[testenv:coverage]
14-
deps=
15-
-r{toxinidir}/requirements/tests.txt
16-
coverage
17-
basepython=python2.7
18-
setenv=
19-
PYTHONWARNINGS=ignore
20-
commands=
21-
coverage run runtests.py {posargs:}
22-
coverage report
23-
coverage erase
24-
25-
[testenv:travis]
26-
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH CODACY_PROJECT_TOKEN
279
deps =
28-
-r{toxinidir}/requirements/tests.txt
2910
coverage
30-
coveralls
31-
codacy-coverage
32-
setenv =
33-
PYTHONWARNINGS=ignore
34-
commands =
11+
mock >= 2.0.0
12+
django19: Django>=1.9,<1.10
13+
django110: Django>=1.10,<1.11
14+
django111: Django>=1.11,<2.0
15+
djangomaster: https://github.com/django/django/archive/master.tar.gz
16+
commands=
3517
coverage run runtests.py {posargs:}
3618
coverage report
3719
coverage xml
38-
coveralls
39-
python-codacy-coverage -r coverage.xml
20+
21+
[testenv:flake8]
22+
deps = flake8
23+
commands = flake8 {toxinidir}/ajax_cbv

0 commit comments

Comments
 (0)