11from argparse import Namespace
22import unittest
3+
4+ import pytest
35from obiba_opal import OpalClient
46from obiba_opal .core import HTTPError
57from os .path import exists
@@ -13,7 +15,7 @@ def setup_class(cls):
1315 # Make sure to place your own certificate files
1416 cls .SSL_CERTIFICATE = "./resources/certificates/publickey.pem"
1517 cls .SSL_KEY = "./resources/certificates/privatekey.pem"
16-
18+
1719 def test_sendRestBadServer (self ):
1820 # FIXME for some reason, the cookie_file is not removed (despite the os.remove()
1921 # is called and os.path.exists() says it was removed)
@@ -24,6 +26,7 @@ def test_sendRestBadServer(self):
2426 except RequestException :
2527 assert True
2628
29+ @pytest .mark .integration
2730 def test_sendRestBadCredentials (self ):
2831 client = OpalClient .buildWithAuthentication (server = TEST_SERVER , user = "admin" , password = TEST_PASSWORD )
2932
@@ -32,6 +35,7 @@ def test_sendRestBadCredentials(self):
3235 finally :
3336 client .close ()
3437
38+ @pytest .mark .integration
3539 def test_sendRest (self ):
3640 client = None
3741 try :
@@ -43,6 +47,7 @@ def test_sendRest(self):
4347 if client :
4448 client .close ()
4549
50+ @pytest .mark .integration
4651 def test_sendSecuredRest (self ):
4752 if exists (self .SSL_CERTIFICATE ):
4853 client = None
@@ -57,6 +62,7 @@ def test_sendSecuredRest(self):
5762 if client :
5863 client .close ()
5964
65+ @pytest .mark .integration
6066 def test_validAuthLoginInfo (self ):
6167 client = None
6268 try :
@@ -69,6 +75,7 @@ def test_validAuthLoginInfo(self):
6975 if client :
7076 client .close ()
7177
78+ @pytest .mark .integration
7279 def test_validSslLoginInfo (self ):
7380 if exists (self .SSL_CERTIFICATE ):
7481 client = None
@@ -86,10 +93,12 @@ def test_validSslLoginInfo(self):
8693 if client :
8794 client .close ()
8895
96+ @pytest .mark .integration
8997 def test_invalidServerInfo (self ):
9098 args = Namespace (opl = TEST_SERVER , user = TEST_USER , password = TEST_PASSWORD )
9199 self .assertRaises (ValueError , OpalClient .LoginInfo .parse , args )
92100
101+ @pytest .mark .integration
93102 def test_invalidLoginInfo (self ):
94103 args = Namespace (opal = TEST_SERVER , usr = "administrator" , password = TEST_PASSWORD )
95104 self .assertRaises (ValueError , OpalClient .LoginInfo .parse , args )
0 commit comments