def is_logged_in(): """ Checks if the user is logged in.""" try: windscribe.login(username, password) return True except: return False
def is_pro_account(): """ Checks if the user has a pro account.""" try: windscribe.login(username, password) return "Free" in windscribe.account().plan except: return False
def test_normal(self): # Tests connect(), and disconnect(). windscribe.login(username, password) self.assertIsNone(windscribe.disconnect()) self.assertIsNone(windscribe.connect()) self.assertIsNone(windscribe.connect(windscribe.locations()[0])) self.assertIsNone(windscribe.disconnect())
def test_normal(self): # Tests locations() and account(). windscribe.login(username, password) windscribe.connect() self.assertIsInstance(windscribe.locations(), list) self.assertIsInstance(windscribe.account(), windscribe.WindscribeAccount)
def test_environment_parameters(self): # Tests login() with the environment variables. with self.assertRaises(InvalidUsernameException): windscribe.login() with self.assertRaises(InvalidPasswordException): windscribe.login(user="******") os.environ.setdefault("WINDSCRIBE_USER", username) os.environ.setdefault("WINDSCRIBE_PW", password) self.assertTrue(windscribe.login()) self.assertFalse(windscribe.login())
def test_invalid_creditials(self): # Tests login() with the invalid creditials. with self.assertRaises(InvalidCredentialsException): windscribe.login("test", "test")
def test_no_connection(self): # Tests login() while not connected to internet. with self.assertRaises(ConnectionError): windscribe.login(username, password) print(windscribe.logout())
def test_normal(self): # Tests login() and logout(). self.assertTrue(windscribe.login(username, password)) self.assertFalse(windscribe.login(username, password)) self.assertTrue(windscribe.logout()) self.assertFalse(windscribe.logout())
def test_pro_location(self): # Tests connect() with a pro account location. windscribe.login(username, password) with self.assertRaises(ProAccountRequiredException): windscribe.connect("WINDFLIX US")
def test_normal(self): # Tests status() and version(). windscribe.login(username, password) windscribe.connect() self.assertIsInstance(windscribe.status(), windscribe.WindscribeStatus) self.assertIsInstance(windscribe.version(), str)