예제 #1
0
    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())
예제 #2
0
    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)
예제 #3
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)
예제 #4
0
    def test_set_password_with_invalid_value(self):
        cfg = EobotConfig()

        with self.assertRaises(ValueError):
            # noinspection PyTypeChecker
            cfg.set_password(123)
예제 #5
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)
예제 #6
0
 def test_set_password_with_valid_value(self):
     cfg = EobotConfig()
     self.assertIsNone(cfg._password)
     cfg.set_password("password")
     self.assertEqual("password", cfg._password)
예제 #7
0
    def test_set_password_without_value(self):
        cfg = EobotConfig()

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