2
2
# -*- coding: utf-8 -*-
3
3
4
4
from proxy import Proxy , NoTalkProxy
5
- from io import StringIO
6
5
import sys
7
6
from time import time
8
7
8
+ if sys .version_info [0 ] == 2 :
9
+ from StringIO import StringIO
10
+ else :
11
+ from io import StringIO
12
+
9
13
if sys .version_info < (2 , 7 ):
10
14
import unittest2 as unittest
11
15
else :
@@ -40,8 +44,8 @@ def test_sales_manager_shall_talk_through_proxy_with_delay(cls):
40
44
expected_print_output = 'Proxy checking for Sales Manager availability\n \
41
45
Sales Manager ready to talk\n '
42
46
cls .assertEqual (print_output , expected_print_output )
43
- expected_execution_time = 2
44
- cls .assertEqual (int (execution_time ), expected_execution_time )
47
+ expected_execution_time = 1
48
+ cls .assertEqual (int (execution_time * 10 ), expected_execution_time )
45
49
46
50
def test_sales_manager_shall_respond_through_proxy_with_delay (cls ):
47
51
cls .p .busy = 'Yes'
@@ -53,8 +57,8 @@ def test_sales_manager_shall_respond_through_proxy_with_delay(cls):
53
57
expected_print_output = 'Proxy checking for Sales Manager availability\n \
54
58
Sales Manager is busy\n '
55
59
cls .assertEqual (print_output , expected_print_output )
56
- expected_execution_time = 2
57
- cls .assertEqual (int (execution_time ), expected_execution_time )
60
+ expected_execution_time = 1
61
+ cls .assertEqual (int (execution_time * 10 ), expected_execution_time )
58
62
59
63
60
64
class NoTalkProxyTest (unittest .TestCase ):
@@ -85,8 +89,8 @@ def test_sales_manager_shall_not_talk_through_proxy_with_delay(cls):
85
89
expected_print_output = 'Proxy checking for Sales Manager availability\n \
86
90
This Sales Manager will not talk to you whether he/she is busy or not\n '
87
91
cls .assertEqual (print_output , expected_print_output )
88
- expected_execution_time = 2
89
- cls .assertEqual (int (execution_time ), expected_execution_time )
92
+ expected_execution_time = 1
93
+ cls .assertEqual (int (execution_time * 10 ), expected_execution_time )
90
94
91
95
def test_sales_manager_shall_not_respond_through_proxy_with_delay (cls ):
92
96
cls .ntp .busy = 'Yes'
@@ -98,8 +102,8 @@ def test_sales_manager_shall_not_respond_through_proxy_with_delay(cls):
98
102
expected_print_output = 'Proxy checking for Sales Manager availability\n \
99
103
This Sales Manager will not talk to you whether he/she is busy or not\n '
100
104
cls .assertEqual (print_output , expected_print_output )
101
- expected_execution_time = 2
102
- cls .assertEqual (int (execution_time ), expected_execution_time )
105
+ expected_execution_time = 1
106
+ cls .assertEqual (int (execution_time * 10 ), expected_execution_time )
103
107
104
108
if __name__ == "__main__" :
105
109
unittest .main ()
0 commit comments