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

Commit bc806f4

Browse files
authored
Merge branch 'master' into feature/statistics
2 parents b5d4c9b + 5ca8df3 commit bc806f4

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

tests/test_packages.py

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
from bintray.bintray import Bintray
2+
3+
4+
def _create_package():
5+
bintray = Bintray()
6+
response = bintray.create_package("uilianries", "generic", "qux", ["MIT"],
7+
"https://github.com/uilianries/bintray-python", None, "foo",
8+
["test", "jfrog", "couse"], "http://example.com",
9+
"https://github.com/uilianries/bintray-python/issues",
10+
"uilianries/bintray-python", None, True)
11+
return response
12+
13+
14+
def test_get_packages():
15+
bintray = Bintray()
16+
response = bintray.get_packages("uilianries", "conan")
17+
assert {'error': False, 'statusCode': 200} in response
18+
19+
20+
def test_get_package():
21+
bintray = Bintray()
22+
response = bintray.get_package("uilianries", "generic", "statistics")
23+
assert response["name"] == "statistics"
24+
25+
26+
def test_create_package():
27+
bintray = Bintray()
28+
try:
29+
bintray.get_package("uilianries", "generic", "qux")
30+
bintray.delete_package("uilianries", "generic", "qux")
31+
except:
32+
pass
33+
34+
response = _create_package()
35+
36+
assert response["name"] == "qux"
37+
assert response["error"] == False
38+
39+
40+
def test_delete_package():
41+
bintray = Bintray()
42+
try:
43+
_create_package()
44+
except:
45+
pass
46+
47+
response = bintray.delete_package("uilianries", "generic", "qux")
48+
49+
assert {'error': False, 'message': 'success', 'statusCode': 200} == response
50+
51+
52+
def test_update_package():
53+
bintray = Bintray()
54+
try:
55+
_create_package()
56+
except:
57+
pass
58+
59+
response = bintray.update_package("uilianries", "generic", "qux", ["MIT"],
60+
"https://github.com/uilianries/bintray-python", None, "foo",
61+
["test", "jfrog", "couse"], "http://example.com",
62+
"https://github.com/uilianries/bintray-python/issues",
63+
"uilianries/bintray-python", None, True)
64+
assert {'error': False, 'message': 'success', 'statusCode': 200} == response
65+
66+
67+
def test_search_package():
68+
bintray = Bintray()
69+
try:
70+
_create_package()
71+
except:
72+
pass
73+
74+
response = bintray.search_package("qux", "foo", "uilianries", "generic")
75+
assert {'error': False, 'statusCode': 200} in response
76+
77+
78+
def test_get_package_for_file():
79+
bintray = Bintray()
80+
response = bintray.get_package_for_file("uilianries", "generic", "packages.json")
81+
82+
assert response["name"] == "statistics"
83+
assert response["repo"] == "generic"
84+
85+
86+
def test_search_maven_package():
87+
bintray = Bintray()
88+
response = bintray.search_maven_package("com.jfrog.bintray.gradle", "*bintray*", None, "jfrog",
89+
"jfrog-jars")
90+
91+
assert [{'error': False, 'statusCode': 200}] == response

0 commit comments

Comments
 (0)