def test_get_password(self): cfg = EobotConfig() self.assertIsNone(cfg.get_password()) cfg.set_password("password") self.assertEqual("password", cfg.get_password()) cfg.set_password(None) self.assertIsNone(cfg.get_password())
def test_get_authentication_write_with_user_id_with_email_with_password_without_token( self): cfg = EobotConfig() cfg.set_user_id(123) cfg.set_email("email") cfg.set_password("password") auth = cfg.get_authentication(False) self.assertIsInstance(auth, EobotWriteAuthentication) self.assertEqual(123, auth.user_id) self.assertEqual("email", auth.email) self.assertEqual("password", auth.password)
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_password_with_invalid_value(self): cfg = EobotConfig() with self.assertRaises(ValueError): # noinspection PyTypeChecker cfg.set_password(123)
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_set_password_with_valid_value(self): cfg = EobotConfig() self.assertIsNone(cfg._password) cfg.set_password("password") self.assertEqual("password", cfg._password)
def test_set_password_without_value(self): cfg = EobotConfig() with self.assertRaises(TypeError): # noinspection PyArgumentList cfg.set_password()