Beispiel #1
0
def is_logged_in():
    """ Checks if the user is logged in."""
    try:
        windscribe.login(username, password)
        return True
    except:
        return False
Beispiel #2
0
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
Beispiel #3
0
 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())
Beispiel #4
0
 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)
Beispiel #5
0
    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())
Beispiel #6
0
 def test_invalid_creditials(self):
     # Tests login() with the invalid creditials.
     with self.assertRaises(InvalidCredentialsException):
         windscribe.login("test", "test")
Beispiel #7
0
    def test_no_connection(self):
        # Tests login() while not connected to internet.
        with self.assertRaises(ConnectionError):
            windscribe.login(username, password)

        print(windscribe.logout())
Beispiel #8
0
 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())
Beispiel #9
0
 def test_pro_location(self):
     # Tests connect() with a pro account location.
     windscribe.login(username, password)
     with self.assertRaises(ProAccountRequiredException):
         windscribe.connect("WINDFLIX US")
Beispiel #10
0
 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)