-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
337 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"info": { | ||
"maintainer": "", | ||
"docs_url": null, | ||
"requires_python": "", | ||
"maintainer_email": "", | ||
"cheesecake_code_kwalitee_id": null, | ||
"keywords": "", | ||
"package_url": "http://pypi.python.org/pypi/package3", | ||
"author": "Package 3 author", | ||
"author_email": "[email protected]", | ||
"download_url": "", | ||
"platform": "", | ||
"version": "1.0.0", | ||
"cheesecake_documentation_id": null, | ||
"_pypi_hidden": false, | ||
"description": "UNKNOWN\n\n\n", | ||
"release_url": "http://pypi.python.org/pypi/package3/1.0.1", | ||
"downloads": { | ||
"last_month": 0, | ||
"last_week": 0, | ||
"last_day": 0 | ||
}, | ||
"_pypi_ordering": 141, | ||
"requires_dist": [], | ||
"classifiers": [], | ||
"name": "Package3", | ||
"bugtrack_url": "", | ||
"license": "GPL-2.0", | ||
"summary": "Python package", | ||
"home_page": "https://www.url.tld/", | ||
"cheesecake_installability_id": null | ||
}, | ||
"releases": { | ||
"1.0.0": [ | ||
{ | ||
"has_sig": false, | ||
"upload_time": "2011-09-29T23:34:21", | ||
"comment_text": "", | ||
"python_version": "source", | ||
"url": "", | ||
"md5_digest": "", | ||
"downloads": 0, | ||
"filename": "package.tar.gz", | ||
"packagetype": "sdist", | ||
"path": "f0/package.tar.gz", | ||
"size": 1234 | ||
} | ||
], | ||
"2.0.0": [ | ||
{ | ||
"has_sig": false, | ||
"upload_time": "2013-11-29T23:34:21", | ||
"comment_text": "", | ||
"python_version": "source", | ||
"url": "", | ||
"md5_digest": "", | ||
"downloads": 0, | ||
"filename": "package.tar.gz", | ||
"packagetype": "sdist", | ||
"path": "f0/package.tar.gz", | ||
"size": 1234 | ||
} | ||
], | ||
"3.0.0": [ | ||
{ | ||
"has_sig": false, | ||
"upload_time": "2015-09-29T23:34:21", | ||
"comment_text": "", | ||
"python_version": "source", | ||
"url": "", | ||
"md5_digest": "", | ||
"downloads": 0, | ||
"filename": "package.tar.gz", | ||
"packagetype": "sdist", | ||
"path": "f0/package.tar.gz", | ||
"size": 1234 | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"info": { | ||
"maintainer": "", | ||
"docs_url": null, | ||
"requires_python": "", | ||
"maintainer_email": "", | ||
"cheesecake_code_kwalitee_id": null, | ||
"keywords": "", | ||
"package_url": "http://pypi.python.org/pypi/package3", | ||
"author": "Package 3 author", | ||
"author_email": "[email protected]", | ||
"download_url": "", | ||
"platform": "", | ||
"version": "2.0.0", | ||
"cheesecake_documentation_id": null, | ||
"_pypi_hidden": false, | ||
"description": "UNKNOWN\n\n\n", | ||
"release_url": "http://pypi.python.org/pypi/package3/1.0.1", | ||
"downloads": { | ||
"last_month": 0, | ||
"last_week": 0, | ||
"last_day": 0 | ||
}, | ||
"_pypi_ordering": 141, | ||
"requires_dist": [], | ||
"classifiers": [], | ||
"name": "Package3", | ||
"bugtrack_url": "", | ||
"license": "GPL-3.0", | ||
"summary": "Python package", | ||
"home_page": "https://www.url.tld/", | ||
"cheesecake_installability_id": null | ||
}, | ||
"releases": { | ||
"1.0.0": [ | ||
{ | ||
"has_sig": false, | ||
"upload_time": "2011-09-29T23:34:21", | ||
"comment_text": "", | ||
"python_version": "source", | ||
"url": "", | ||
"md5_digest": "", | ||
"downloads": 0, | ||
"filename": "package.tar.gz", | ||
"packagetype": "sdist", | ||
"path": "f0/package.tar.gz", | ||
"size": 1234 | ||
} | ||
], | ||
"2.0.0": [ | ||
{ | ||
"has_sig": false, | ||
"upload_time": "2013-11-29T23:34:21", | ||
"comment_text": "", | ||
"python_version": "source", | ||
"url": "", | ||
"md5_digest": "", | ||
"downloads": 0, | ||
"filename": "package.tar.gz", | ||
"packagetype": "sdist", | ||
"path": "f0/package.tar.gz", | ||
"size": 1234 | ||
} | ||
], | ||
"3.0.0": [ | ||
{ | ||
"has_sig": false, | ||
"upload_time": "2015-09-29T23:34:21", | ||
"comment_text": "", | ||
"python_version": "source", | ||
"url": "", | ||
"md5_digest": "", | ||
"downloads": 0, | ||
"filename": "package.tar.gz", | ||
"packagetype": "sdist", | ||
"path": "f0/package.tar.gz", | ||
"size": 1234 | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"info": { | ||
"maintainer": "", | ||
"docs_url": null, | ||
"requires_python": "", | ||
"maintainer_email": "", | ||
"cheesecake_code_kwalitee_id": null, | ||
"keywords": "", | ||
"package_url": "http://pypi.python.org/pypi/package3", | ||
"author": "Package 3 author", | ||
"author_email": "[email protected]", | ||
"download_url": "", | ||
"platform": "", | ||
"version": "3.0.0", | ||
"cheesecake_documentation_id": null, | ||
"_pypi_hidden": false, | ||
"description": "UNKNOWN\n\n\n", | ||
"release_url": "http://pypi.python.org/pypi/package3/1.0.1", | ||
"downloads": { | ||
"last_month": 0, | ||
"last_week": 0, | ||
"last_day": 0 | ||
}, | ||
"_pypi_ordering": 141, | ||
"requires_dist": [], | ||
"classifiers": [], | ||
"name": "Package3", | ||
"bugtrack_url": "", | ||
"license": "MIT", | ||
"summary": "Python package", | ||
"home_page": "https://www.url.tld/", | ||
"cheesecake_installability_id": null | ||
}, | ||
"releases": { | ||
"1.0.0": [ | ||
{ | ||
"has_sig": false, | ||
"upload_time": "2011-09-29T23:34:21", | ||
"comment_text": "", | ||
"python_version": "source", | ||
"url": "", | ||
"md5_digest": "", | ||
"downloads": 0, | ||
"filename": "package.tar.gz", | ||
"packagetype": "sdist", | ||
"path": "f0/package.tar.gz", | ||
"size": 1234 | ||
} | ||
], | ||
"2.0.0": [ | ||
{ | ||
"has_sig": false, | ||
"upload_time": "2013-11-29T23:34:21", | ||
"comment_text": "", | ||
"python_version": "source", | ||
"url": "", | ||
"md5_digest": "", | ||
"downloads": 0, | ||
"filename": "package.tar.gz", | ||
"packagetype": "sdist", | ||
"path": "f0/package.tar.gz", | ||
"size": 1234 | ||
} | ||
], | ||
"3.0.0": [ | ||
{ | ||
"has_sig": false, | ||
"upload_time": "2015-09-29T23:34:21", | ||
"comment_text": "", | ||
"python_version": "source", | ||
"url": "", | ||
"md5_digest": "", | ||
"downloads": 0, | ||
"filename": "package.tar.gz", | ||
"packagetype": "sdist", | ||
"path": "f0/package.tar.gz", | ||
"size": 1234 | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python | ||
import unittest | ||
import os | ||
import json | ||
|
||
import updatable | ||
|
||
|
||
PATH = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
|
||
def get_pypi_package_data_monkey(package_name, version=None): | ||
if version: | ||
json_file = 'pypi-%s-%s.json' % (package_name, version) | ||
else: | ||
json_file = 'pypi-%s.json' % package_name | ||
|
||
with open(os.path.join(PATH, 'fixtures', json_file)) as data_file: | ||
return json.load(data_file) | ||
|
||
|
||
class TestUpdateLicense(unittest.TestCase): | ||
""" | ||
Tests package updatability | ||
""" | ||
|
||
def setUp(self): | ||
self.get_pypi_package_data_orig = updatable.get_pypi_package_data | ||
updatable.get_pypi_package_data = get_pypi_package_data_monkey | ||
|
||
def tearDown(self): | ||
updatable.get_pypi_package_data = self.get_pypi_package_data_orig | ||
|
||
def test_update_license(self): | ||
""" | ||
Test update count for a package that has only major releases | ||
""" | ||
updates = updatable.get_package_update_list('package3', '1.0.0') | ||
self.assertEqual(updates['current_release'], '1.0.0') | ||
self.assertEqual(updates['latest_release'], '3.0.0') | ||
self.assertEqual(updates['current_release_license'], 'GPL-2.0') | ||
self.assertEqual(updates['latest_release_license'], 'MIT') | ||
|
||
updates = updatable.get_package_update_list('package3', '2.0.0') | ||
self.assertEqual(updates['current_release'], '2.0.0') | ||
self.assertEqual(updates['latest_release'], '3.0.0') | ||
self.assertEqual(updates['current_release_license'], 'GPL-3.0') | ||
self.assertEqual(updates['latest_release_license'], 'MIT') | ||
|
||
updates = updatable.get_package_update_list('package3', '3.0.0') | ||
self.assertEqual(updates['current_release'], '3.0.0') | ||
self.assertEqual(updates['latest_release'], '3.0.0') | ||
self.assertEqual(updates['current_release_license'], 'MIT') | ||
self.assertEqual(updates['latest_release_license'], 'MIT') | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Oops, something went wrong.