예제 #1
0
    def test_get_authentication_write_with_user_id_with_email_without_password_or_token(
            self):
        cfg = EobotConfig()
        cfg.set_user_id(123)
        cfg.set_email("email")

        with self.assertRaises(NoPasswordOrTokenError):
            cfg.get_authentication(False)
예제 #2
0
    def test_get_authentication_readonly_with_user_id(self):
        cfg = EobotConfig()
        cfg.set_user_id(123)

        auth = cfg.get_authentication(True)
        self.assertIsInstance(auth, EobotReadonlyAuthentication)
        self.assertEqual(123, auth.user_id)
예제 #3
0
    def test_get_authentication_write_with_user_id_with_email_without_password_with_token(
            self):
        cfg = EobotConfig()
        cfg.set_user_id(123)
        cfg.set_email("email")
        cfg.set_token("token")

        auth = cfg.get_authentication(False)
        self.assertIsInstance(auth, EobotWriteAuthentication)
        self.assertEqual(123, auth.user_id)
        self.assertEqual("email", auth.email)
        self.assertEqual("token", auth.password)
예제 #4
0
    def test_get_authentication_write_with_user_id_with_email_with_password_with_token(
            self):
        cfg = EobotConfig()
        cfg.set_user_id(123)
        cfg.set_email("email")
        cfg.set_password("password")
        cfg.set_token("token")

        auth = cfg.get_authentication(False)
        self.assertIsInstance(auth, EobotWriteAuthentication)
        self.assertEqual(123, auth.user_id)
        self.assertEqual("email", auth.email)
        # token takes precedence over password, if available
        self.assertEqual("token", auth.password)
예제 #5
0
    def test_get_authentication_write_with_user_id_without_email(self):
        cfg = EobotConfig()
        cfg.set_user_id(123)

        with self.assertRaises(NoEmailError):
            cfg.get_authentication(False)
예제 #6
0
    def test_get_authentication_write_without_user_id(self):
        cfg = EobotConfig()

        with self.assertRaises(NoUserIdError):
            cfg.get_authentication(False)
예제 #7
0
    def test_get_authentication_readonly_without_user_id(self):
        cfg = EobotConfig()

        with self.assertRaises(NoUserIdError):
            cfg.get_authentication(True)