Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 6
0
    def test_get_authentication_write_without_user_id(self):
        cfg = EobotConfig()

        with self.assertRaises(NoUserIdError):
            cfg.get_authentication(False)
Ejemplo n.º 7
0
    def test_get_authentication_readonly_without_user_id(self):
        cfg = EobotConfig()

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