Skip to content

Commit 56807bf

Browse files
committed
Adds license information
1 parent dd37fb7 commit 56807bf

File tree

7 files changed

+337
-10
lines changed

7 files changed

+337
-10
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"info": {
3+
"maintainer": "",
4+
"docs_url": null,
5+
"requires_python": "",
6+
"maintainer_email": "",
7+
"cheesecake_code_kwalitee_id": null,
8+
"keywords": "",
9+
"package_url": "http://pypi.python.org/pypi/package3",
10+
"author": "Package 3 author",
11+
"author_email": "[email protected]",
12+
"download_url": "",
13+
"platform": "",
14+
"version": "1.0.0",
15+
"cheesecake_documentation_id": null,
16+
"_pypi_hidden": false,
17+
"description": "UNKNOWN\n\n\n",
18+
"release_url": "http://pypi.python.org/pypi/package3/1.0.1",
19+
"downloads": {
20+
"last_month": 0,
21+
"last_week": 0,
22+
"last_day": 0
23+
},
24+
"_pypi_ordering": 141,
25+
"requires_dist": [],
26+
"classifiers": [],
27+
"name": "Package3",
28+
"bugtrack_url": "",
29+
"license": "GPL-2.0",
30+
"summary": "Python package",
31+
"home_page": "https://www.url.tld/",
32+
"cheesecake_installability_id": null
33+
},
34+
"releases": {
35+
"1.0.0": [
36+
{
37+
"has_sig": false,
38+
"upload_time": "2011-09-29T23:34:21",
39+
"comment_text": "",
40+
"python_version": "source",
41+
"url": "",
42+
"md5_digest": "",
43+
"downloads": 0,
44+
"filename": "package.tar.gz",
45+
"packagetype": "sdist",
46+
"path": "f0/package.tar.gz",
47+
"size": 1234
48+
}
49+
],
50+
"2.0.0": [
51+
{
52+
"has_sig": false,
53+
"upload_time": "2013-11-29T23:34:21",
54+
"comment_text": "",
55+
"python_version": "source",
56+
"url": "",
57+
"md5_digest": "",
58+
"downloads": 0,
59+
"filename": "package.tar.gz",
60+
"packagetype": "sdist",
61+
"path": "f0/package.tar.gz",
62+
"size": 1234
63+
}
64+
],
65+
"3.0.0": [
66+
{
67+
"has_sig": false,
68+
"upload_time": "2015-09-29T23:34:21",
69+
"comment_text": "",
70+
"python_version": "source",
71+
"url": "",
72+
"md5_digest": "",
73+
"downloads": 0,
74+
"filename": "package.tar.gz",
75+
"packagetype": "sdist",
76+
"path": "f0/package.tar.gz",
77+
"size": 1234
78+
}
79+
]
80+
}
81+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"info": {
3+
"maintainer": "",
4+
"docs_url": null,
5+
"requires_python": "",
6+
"maintainer_email": "",
7+
"cheesecake_code_kwalitee_id": null,
8+
"keywords": "",
9+
"package_url": "http://pypi.python.org/pypi/package3",
10+
"author": "Package 3 author",
11+
"author_email": "[email protected]",
12+
"download_url": "",
13+
"platform": "",
14+
"version": "2.0.0",
15+
"cheesecake_documentation_id": null,
16+
"_pypi_hidden": false,
17+
"description": "UNKNOWN\n\n\n",
18+
"release_url": "http://pypi.python.org/pypi/package3/1.0.1",
19+
"downloads": {
20+
"last_month": 0,
21+
"last_week": 0,
22+
"last_day": 0
23+
},
24+
"_pypi_ordering": 141,
25+
"requires_dist": [],
26+
"classifiers": [],
27+
"name": "Package3",
28+
"bugtrack_url": "",
29+
"license": "GPL-3.0",
30+
"summary": "Python package",
31+
"home_page": "https://www.url.tld/",
32+
"cheesecake_installability_id": null
33+
},
34+
"releases": {
35+
"1.0.0": [
36+
{
37+
"has_sig": false,
38+
"upload_time": "2011-09-29T23:34:21",
39+
"comment_text": "",
40+
"python_version": "source",
41+
"url": "",
42+
"md5_digest": "",
43+
"downloads": 0,
44+
"filename": "package.tar.gz",
45+
"packagetype": "sdist",
46+
"path": "f0/package.tar.gz",
47+
"size": 1234
48+
}
49+
],
50+
"2.0.0": [
51+
{
52+
"has_sig": false,
53+
"upload_time": "2013-11-29T23:34:21",
54+
"comment_text": "",
55+
"python_version": "source",
56+
"url": "",
57+
"md5_digest": "",
58+
"downloads": 0,
59+
"filename": "package.tar.gz",
60+
"packagetype": "sdist",
61+
"path": "f0/package.tar.gz",
62+
"size": 1234
63+
}
64+
],
65+
"3.0.0": [
66+
{
67+
"has_sig": false,
68+
"upload_time": "2015-09-29T23:34:21",
69+
"comment_text": "",
70+
"python_version": "source",
71+
"url": "",
72+
"md5_digest": "",
73+
"downloads": 0,
74+
"filename": "package.tar.gz",
75+
"packagetype": "sdist",
76+
"path": "f0/package.tar.gz",
77+
"size": 1234
78+
}
79+
]
80+
}
81+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"info": {
3+
"maintainer": "",
4+
"docs_url": null,
5+
"requires_python": "",
6+
"maintainer_email": "",
7+
"cheesecake_code_kwalitee_id": null,
8+
"keywords": "",
9+
"package_url": "http://pypi.python.org/pypi/package3",
10+
"author": "Package 3 author",
11+
"author_email": "[email protected]",
12+
"download_url": "",
13+
"platform": "",
14+
"version": "3.0.0",
15+
"cheesecake_documentation_id": null,
16+
"_pypi_hidden": false,
17+
"description": "UNKNOWN\n\n\n",
18+
"release_url": "http://pypi.python.org/pypi/package3/1.0.1",
19+
"downloads": {
20+
"last_month": 0,
21+
"last_week": 0,
22+
"last_day": 0
23+
},
24+
"_pypi_ordering": 141,
25+
"requires_dist": [],
26+
"classifiers": [],
27+
"name": "Package3",
28+
"bugtrack_url": "",
29+
"license": "MIT",
30+
"summary": "Python package",
31+
"home_page": "https://www.url.tld/",
32+
"cheesecake_installability_id": null
33+
},
34+
"releases": {
35+
"1.0.0": [
36+
{
37+
"has_sig": false,
38+
"upload_time": "2011-09-29T23:34:21",
39+
"comment_text": "",
40+
"python_version": "source",
41+
"url": "",
42+
"md5_digest": "",
43+
"downloads": 0,
44+
"filename": "package.tar.gz",
45+
"packagetype": "sdist",
46+
"path": "f0/package.tar.gz",
47+
"size": 1234
48+
}
49+
],
50+
"2.0.0": [
51+
{
52+
"has_sig": false,
53+
"upload_time": "2013-11-29T23:34:21",
54+
"comment_text": "",
55+
"python_version": "source",
56+
"url": "",
57+
"md5_digest": "",
58+
"downloads": 0,
59+
"filename": "package.tar.gz",
60+
"packagetype": "sdist",
61+
"path": "f0/package.tar.gz",
62+
"size": 1234
63+
}
64+
],
65+
"3.0.0": [
66+
{
67+
"has_sig": false,
68+
"upload_time": "2015-09-29T23:34:21",
69+
"comment_text": "",
70+
"python_version": "source",
71+
"url": "",
72+
"md5_digest": "",
73+
"downloads": 0,
74+
"filename": "package.tar.gz",
75+
"packagetype": "sdist",
76+
"path": "f0/package.tar.gz",
77+
"size": 1234
78+
}
79+
]
80+
}
81+
}

test/test_update.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
PATH = os.path.dirname(os.path.realpath(__file__))
1111

1212

13-
def get_pypi_package_data_monkey(package_name):
14-
with open(os.path.join(PATH, 'fixtures', 'pypi-%s.json' % package_name)) as data_file:
13+
def get_pypi_package_data_monkey(package_name, version=None):
14+
json_file = 'pypi-%s.json' % package_name
15+
16+
with open(os.path.join(PATH, 'fixtures', json_file)) as data_file:
1517
return json.load(data_file)
1618

1719

test/test_update_license.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env python
2+
import unittest
3+
import os
4+
import json
5+
6+
import updatable
7+
8+
9+
PATH = os.path.dirname(os.path.realpath(__file__))
10+
11+
12+
def get_pypi_package_data_monkey(package_name, version=None):
13+
if version:
14+
json_file = 'pypi-%s-%s.json' % (package_name, version)
15+
else:
16+
json_file = 'pypi-%s.json' % package_name
17+
18+
with open(os.path.join(PATH, 'fixtures', json_file)) as data_file:
19+
return json.load(data_file)
20+
21+
22+
class TestUpdateLicense(unittest.TestCase):
23+
"""
24+
Tests package updatability
25+
"""
26+
27+
def setUp(self):
28+
self.get_pypi_package_data_orig = updatable.get_pypi_package_data
29+
updatable.get_pypi_package_data = get_pypi_package_data_monkey
30+
31+
def tearDown(self):
32+
updatable.get_pypi_package_data = self.get_pypi_package_data_orig
33+
34+
def test_update_license(self):
35+
"""
36+
Test update count for a package that has only major releases
37+
"""
38+
updates = updatable.get_package_update_list('package3', '1.0.0')
39+
self.assertEqual(updates['current_release'], '1.0.0')
40+
self.assertEqual(updates['latest_release'], '3.0.0')
41+
self.assertEqual(updates['current_release_license'], 'GPL-2.0')
42+
self.assertEqual(updates['latest_release_license'], 'MIT')
43+
44+
updates = updatable.get_package_update_list('package3', '2.0.0')
45+
self.assertEqual(updates['current_release'], '2.0.0')
46+
self.assertEqual(updates['latest_release'], '3.0.0')
47+
self.assertEqual(updates['current_release_license'], 'GPL-3.0')
48+
self.assertEqual(updates['latest_release_license'], 'MIT')
49+
50+
updates = updatable.get_package_update_list('package3', '3.0.0')
51+
self.assertEqual(updates['current_release'], '3.0.0')
52+
self.assertEqual(updates['latest_release'], '3.0.0')
53+
self.assertEqual(updates['current_release_license'], 'MIT')
54+
self.assertEqual(updates['latest_release_license'], 'MIT')
55+
56+
57+
if __name__ == '__main__':
58+
unittest.main()

0 commit comments

Comments
 (0)