diff --git a/pyogp/lib/base/tests/test_ogplogin.py b/pyogp/lib/base/tests/test_ogplogin.py index eb6eeb0..5017fcc 100644 --- a/pyogp/lib/base/tests/test_ogplogin.py +++ b/pyogp/lib/base/tests/test_ogplogin.py @@ -7,11 +7,20 @@ from pyogp.lib.base.interfaces import IPlaceAvatarAdapter from pyogp.lib.base.OGPLogin import OGPLogin -class TestOGPLogin(unittest.TestCase): - def test_login(self): +class testAuthOGPLogin(unittest.TestCase): + auth_uri = None + region_uri = None + + def setUp(self): + auth_uri = 'https://login1.aditi.lindenlab.com/cgi-bin/auth.cgi' + region_uri = 'http://sim1.vaak.lindenlab.com:13000' + + def tearDown(self): + # essentially logout by deleting presence... etc. + + def test_base(self): credentials = PlainPasswordCredential('firstname', 'lastname', 'password') - #create a login, giving it the credentials, the loginuri, and the regionuri - ogpLogin = OGPLogin(credentials, 'https://login1.aditi.lindenlab.com/cgi-bin/auth.cgi', 'http://sim1.vaak.lindenlab.com:13000') + ogpLogin = OGPLogin(credentials, auth_uri, region_uri) #gets seedcap, and an agent that can be placed in a region agentdomain, agent = ogpLogin.loginToAgentD() @@ -20,9 +29,20 @@ class TestOGPLogin(unittest.TestCase): #attempts to place the agent in a region avatar = ogpLogin.placeAvatarCap() assert avatar['connect'] == True, "Place avatar failed" + + def test_banned(self): + credentials = PlainPasswordCredential('BannedTester', 'Tester', 'banned_password') + ogpLogin = OGPLogin(credentials, auth_uri, region_uri) + + #gets seedcap, and an agent that can be placed in a region + try: + agentdomain, agent = ogpLogin.loginToAgentD() + assert False, "Login to banned account should fail" + except Exception, e: + pass def test_suite(): from unittest import TestSuite, makeSuite suite = TestSuite() - suite.addTest(makeSuite(TestOGPLogin)) + suite.addTest(makeSuite(testBaseOGPLogin)) return suite