Skip to content

Commit 56b459a

Browse files
committed
[UPDATE] added tests for HTTPProxy model
1 parent 51cc21a commit 56b459a

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

linkedin/tests.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
11
from django.test import TestCase
22

3-
# Create your tests here.
3+
from linkedin.models import HTTPProxy
4+
5+
6+
class HTTPProxyModelTest(TestCase):
7+
8+
def test_link_property_without_username_and_password(self):
9+
proxy = HTTPProxy(host="example.com", port=8080)
10+
self.assertEqual(
11+
proxy.link,
12+
"http://example.com:8080",
13+
)
14+
15+
def test_link_property_with_username_and_password(self):
16+
proxy = HTTPProxy(
17+
host="example.com", port=8080, username="user", password="pass"
18+
)
19+
self.assertEqual(
20+
proxy.link,
21+
"http://user:pass@example.com:8080",
22+
)
23+
24+
def test_link_dict_property_without_username_and_password(self):
25+
proxy = HTTPProxy(host="example.com", port=8080)
26+
self.assertEqual(
27+
proxy.link_dict,
28+
{
29+
"http": "http://example.com:8080",
30+
"https": "http://example.com:8080",
31+
},
32+
)
33+
34+
def test_link_dict_property_with_username_and_password(self):
35+
proxy = HTTPProxy(
36+
host="example.com", port=8080, username="user", password="pass"
37+
)
38+
self.assertEqual(
39+
proxy.link_dict,
40+
{
41+
"http": "http://user:pass@example.com:8080",
42+
"https": "http://user:pass@example.com:8080",
43+
},
44+
)

0 commit comments

Comments
 (0)