def setUpClass(cls): """ Pre class execution """ cls.config = ConfigParser.ConfigParser() cls.config.read(PLCFG) cls.username = cls.config.get(USER_SEC, 'username') cls.password = cls.config.get(USER_SEC, 'password') cls.url = cls.config.get(USER_SEC, 'url') if cls.config.has_section(MYSQL_SEC): cls.myuser = cls.config.get(MYSQL_SEC, 'user') cls.mypass = cls.config.get(MYSQL_SEC, 'password') cls.mydbname = cls.config.get(MYSQL_SEC, 'dbname') cls.myhost = cls.config.get(MYSQL_SEC, 'host') if cls.config.has_section(MAILGUN_SEC): cls.mg_key = cls.config.get(MAILGUN_SEC, 'private') cls.mailgun = mailgun.MailGunApi(cls.mg_key) cls.api = powerline.powerline(cls.username, cls.password, cls.url) cls.api.login()
def test_login(self): """ Basic login test """ api = powerline.powerline(self.username, self.password, self.url) token = api.login() self.assertTrue( token )