Пример #1
0
    def test_get_authentication_write_without_user_id(self):
        cfg = EobotConfig()

        with self.assertRaises(NoUserIdError):
            cfg.get_authentication(False)
Пример #2
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)
Пример #3
0
    def test_set_token_with_invalid_value(self):
        cfg = EobotConfig()

        with self.assertRaises(ValueError):
            # noinspection PyTypeChecker
            cfg.set_token(123)
Пример #4
0
    def test_get_authentication_readonly_without_user_id(self):
        cfg = EobotConfig()

        with self.assertRaises(NoUserIdError):
            cfg.get_authentication(True)
Пример #5
0
    def test_configure_with_invalid_token(self):
        cfg = EobotConfig()

        with self.assertRaises(ValueError):
            # noinspection PyTypeChecker
            cfg.configure(token=123)
Пример #6
0
 def test_set_token_with_none_value(self):
     cfg = EobotConfig()
     cfg.configure(token="token")
     self.assertEqual("token", cfg._token)
     cfg.set_token(None)
     self.assertIsNone(cfg._token)
Пример #7
0
 def test_set_password_with_none_value(self):
     cfg = EobotConfig()
     cfg.configure(password="******")
     self.assertEqual("password", cfg._password)
     cfg.set_password(None)
     self.assertIsNone(cfg._password)
Пример #8
0
    def test_configure_with_invalid_user_id(self):
        cfg = EobotConfig()

        with self.assertRaises(ValueError):
            # noinspection PyTypeChecker
            cfg.configure(user_id="123")
Пример #9
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)
Пример #10
0
 def test_set_password_with_valid_value(self):
     cfg = EobotConfig()
     self.assertIsNone(cfg._password)
     cfg.set_password("password")
     self.assertEqual("password", cfg._password)
Пример #11
0
 def test_set_email_with_valid_value(self):
     cfg = EobotConfig()
     self.assertIsNone(cfg._email)
     cfg.set_email("email")
     self.assertEqual("email", cfg._email)
Пример #12
0
 def test_set_user_id_with_none_value(self):
     cfg = EobotConfig()
     cfg.configure(user_id=123)
     self.assertEqual(123, cfg._user_id)
     cfg.set_user_id(None)
     self.assertIsNone(cfg._user_id)
Пример #13
0
 def test_set_user_id_with_valid_value(self):
     cfg = EobotConfig()
     self.assertIsNone(cfg._user_id)
     cfg.set_user_id(123)
     self.assertEqual(123, cfg._user_id)
Пример #14
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)
Пример #15
0
    def test_set_token_without_value(self):
        cfg = EobotConfig()

        with self.assertRaises(TypeError):
            # noinspection PyArgumentList
            cfg.set_token()
Пример #16
0
 def test_configure_with_valid_user_id(self):
     cfg = EobotConfig()
     cfg.configure(user_id=123)
     self.assertEqual(123, cfg._user_id)
Пример #17
0
 def test_set_token_with_valid_value(self):
     cfg = EobotConfig()
     self.assertIsNone(cfg._token)
     cfg.set_token("token")
     self.assertEqual("token", cfg._token)
Пример #18
0
 def test_configure_with_valid_email(self):
     cfg = EobotConfig()
     cfg.configure(email="email")
     self.assertEqual("email", cfg._email)
Пример #19
0
 def test_configure_with_valid_token(self):
     cfg = EobotConfig()
     cfg.configure(token="token")
     self.assertEqual("token", cfg._token)