File tree Expand file tree Collapse file tree 1 file changed +42
-1
lines changed Expand file tree Collapse file tree 1 file changed +42
-1
lines changed Original file line number Diff line number Diff line change 1
1
from django .test import TestCase
2
2
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
+ )
You can’t perform that action at this time.
0 commit comments