def test_http_error(self): plugin = PDMLogin(arguments=[ "--url", "http://numgen.app.corp:11108/prod_ng", "--cloneid", "17cu31oma", "--login", "csu", "--password", "P@ssw0rd" ]) with self.assertRaises(PDMHttpError): plugin.login()
def test_unauthorized_login(self): plugin = PDMLogin(arguments=[ "--url", "http://numgen.app.corp:11105/prod_ng", "--cloneid", "17cu31oma", "--login", "csua", "--password", "P@ssw0rd" ]) with self.assertRaises(PDMLoginFailed): plugin.login()
def test_http_error(self): plugin = PDMLogin( arguments=["--url", "http://numgen.app.corp:11108/prod_ng", "--cloneid", "17cu31oma", "--login", "csu", "--password", "P@ssw0rd"]) with self.assertRaises(PDMHttpError): plugin.login()
def test_unauthorized_login(self): plugin = PDMLogin( arguments=["--url", "http://numgen.app.corp:11105/prod_ng", "--cloneid", "17cu31oma", "--login", "csua", "--password", "P@ssw0rd"]) with self.assertRaises(PDMLoginFailed): plugin.login()
def test_bad_cloneid(self): plugin = PDMLogin(arguments=[ "--url", "http://numgen.app.corp:11105/prod_ng", "--cloneid", "17cu31oma", "--login", "csu", "--password", "P@ssw0rd" ]) plugin.login() cloneids = plugin.session.cookies["JSESSIONID"].split(":")[1:] self.assertEqual(2, len(cloneids))
def test_bad_cloneid(self): plugin = PDMLogin( arguments=["--url", "http://numgen.app.corp:11105/prod_ng", "--cloneid", "17cu31oma", "--login", "csu", "--password", "P@ssw0rd"]) plugin.login() cloneids = plugin.session.cookies["JSESSIONID"].split(":")[1:] self.assertEqual(2, len(cloneids))
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. #=============================================================================== import pdm from pdm.plugin import PDMLogin from pdm.exceptions import PDMHttpError, PDMLoginFailed plugin = PDMLogin("Test login to PDM using HTTP on a specified node.", version=pdm.VERSION) # Main tests try: plugin.login() jsessionid = plugin.session.cookies["JSESSIONID"].split(":") # jsessionid is the list composed of [token, bad_cloneid, good_cloneid] # It has 3 values instead of 2 when the cloneid specified from command line # cannot be reached. if len(jsessionid) > 2: print "CRITICAL - Login on node '{}' is not possible !".format( plugin.args.cloneid) raise SystemExit(2) else: print "OK - Login is successful on node '{}'.".format( plugin.args.cloneid) raise SystemExit(0) except PDMLoginFailed as e: # Login has failed
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. #=============================================================================== import pdm from pdm.plugin import PDMLogin from pdm.exceptions import PDMHttpError, PDMLoginFailed plugin = PDMLogin("Test login to PDM using HTTP on a specified node.", version=pdm.VERSION) # Main tests try: plugin.login() jsessionid = plugin.session.cookies["JSESSIONID"].split(":") # jsessionid is the list composed of [token, bad_cloneid, good_cloneid] # It has 3 values instead of 2 when the cloneid specified from command line # cannot be reached. if len(jsessionid) > 2: print "CRITICAL - Login on node '{}' is not possible !".format( plugin.args.cloneid) raise SystemExit(2) else: print "OK - Login is successful on node '{}'.".format( plugin.args.cloneid) raise SystemExit(0) except PDMLoginFailed as e: # Login has failed