示例#1
0
def is_logged_in():
    """ Checks if the user is logged in."""
    try:
        windscribe.login(username, password)
        return True
    except:
        return False
示例#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
示例#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())
示例#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)
示例#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())
示例#6
0
 def test_invalid_creditials(self):
     # Tests login() with the invalid creditials.
     with self.assertRaises(InvalidCredentialsException):
         windscribe.login("test", "test")
示例#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())
示例#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())
示例#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")
示例#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)