Example #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)
Example #2
0
    def test_get_email(self):
        cfg = EobotConfig()
        self.assertIsNone(cfg.get_email())

        cfg.set_email("email")
        self.assertEqual("email", cfg.get_email())

        cfg.set_email(None)
        self.assertIsNone(cfg.get_email())
Example #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)
Example #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)
Example #5
0
    def test_set_email_with_invalid_value(self):
        cfg = EobotConfig()

        with self.assertRaises(ValueError):
            # noinspection PyTypeChecker
            cfg.set_email(123)
Example #6
0
 def test_set_email_with_none_value(self):
     cfg = EobotConfig()
     cfg.configure(email="email")
     self.assertEqual("email", cfg._email)
     cfg.set_email(None)
     self.assertIsNone(cfg._email)
Example #7
0
 def test_set_email_with_valid_value(self):
     cfg = EobotConfig()
     self.assertIsNone(cfg._email)
     cfg.set_email("email")
     self.assertEqual("email", cfg._email)
Example #8
0
    def test_set_email_without_value(self):
        cfg = EobotConfig()

        with self.assertRaises(TypeError):
            # noinspection PyArgumentList
            cfg.set_email()