def test_get_authentication_write_without_user_id(self): cfg = EobotConfig() with self.assertRaises(NoUserIdError): cfg.get_authentication(False)
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)
def test_set_token_with_invalid_value(self): cfg = EobotConfig() with self.assertRaises(ValueError): # noinspection PyTypeChecker cfg.set_token(123)
def test_get_authentication_readonly_without_user_id(self): cfg = EobotConfig() with self.assertRaises(NoUserIdError): cfg.get_authentication(True)
def test_configure_with_invalid_token(self): cfg = EobotConfig() with self.assertRaises(ValueError): # noinspection PyTypeChecker cfg.configure(token=123)
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)
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)
def test_configure_with_invalid_user_id(self): cfg = EobotConfig() with self.assertRaises(ValueError): # noinspection PyTypeChecker cfg.configure(user_id="123")
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)
def test_set_password_with_valid_value(self): cfg = EobotConfig() self.assertIsNone(cfg._password) cfg.set_password("password") self.assertEqual("password", cfg._password)
def test_set_email_with_valid_value(self): cfg = EobotConfig() self.assertIsNone(cfg._email) cfg.set_email("email") self.assertEqual("email", cfg._email)
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)
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)
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)
def test_set_token_without_value(self): cfg = EobotConfig() with self.assertRaises(TypeError): # noinspection PyArgumentList cfg.set_token()
def test_configure_with_valid_user_id(self): cfg = EobotConfig() cfg.configure(user_id=123) self.assertEqual(123, cfg._user_id)
def test_set_token_with_valid_value(self): cfg = EobotConfig() self.assertIsNone(cfg._token) cfg.set_token("token") self.assertEqual("token", cfg._token)
def test_configure_with_valid_email(self): cfg = EobotConfig() cfg.configure(email="email") self.assertEqual("email", cfg._email)
def test_configure_with_valid_token(self): cfg = EobotConfig() cfg.configure(token="token") self.assertEqual("token", cfg._token)