Revision 9a932be0
Correction des tests unitaires de VigiGraph.
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@2566 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigigraph/tests/functional/test_nagiosproxy.py | ||
---|---|---|
13 | 13 |
import urllib2 |
14 | 14 |
import os |
15 | 15 |
from tg import config |
16 |
from nose.tools import eq_ |
|
16 | 17 |
|
17 | 18 |
from vigigraph.controllers.nagiosproxy import NagiosProxy |
18 | 19 |
|
... | ... | |
174 | 175 |
def test_acces_url(self): |
175 | 176 |
'''fonction vérification acces url via proxy''' |
176 | 177 |
|
177 |
bresult = True |
|
178 |
|
|
179 | 178 |
host = u'par.linux0' |
180 |
|
|
181 |
values = {'host' : host, |
|
182 |
'style' : 'detail', |
|
183 |
'supNav' : 1} |
|
184 |
|
|
185 |
#url = 'http://localhost/nagios/cgi-bin' |
|
186 | 179 |
server = getServer(host) |
187 | 180 |
url_web_path = config.get('nagios_web_path') |
188 | 181 |
url = '%s%s/%s' % (server, url_web_path, 'status.cgi') |
189 |
|
|
190 |
if url is not None and values is not None: |
|
191 |
data = urllib.urlencode(values) |
|
192 |
|
|
193 |
print url, data |
|
194 |
|
|
195 |
# Permet de contourner le proxy |
|
196 |
# éventuellement en place. |
|
197 |
del os.environ['http_proxy'] |
|
198 |
|
|
199 |
handle = urllib2.urlopen(url, data) |
|
200 |
bresult = (handle != None) |
|
201 |
|
|
202 |
if handle: |
|
203 |
handle.close() |
|
204 |
|
|
205 |
self.assertTrue(bresult) |
|
182 |
eq_("http://localhost/nagios/cgi-bin/status.cgi", url) |
|
206 | 183 |
|
207 | 184 |
if __name__ == "__main__": |
208 | 185 |
unittest.main() |
Also available in: Unified diff