예제 #1
0
    def test_configure_with_none_token(self):
        cfg = EobotConfig()
        cfg.configure(token="token")
        self.assertEqual("token", cfg._token)

        cfg.configure(token=None)
        self.assertIsNone(cfg._token)
예제 #2
0
    def test_configure_with_none_email(self):
        cfg = EobotConfig()
        cfg.configure(email="email")
        self.assertEqual("email", cfg._email)

        cfg.configure(email=None)
        self.assertIsNone(cfg._email)
예제 #3
0
    def test_configure_with_none_password(self):
        cfg = EobotConfig()
        cfg.configure(password="******")
        self.assertEqual("password", cfg._password)

        cfg.configure(password=None)
        self.assertIsNone(cfg._password)
예제 #4
0
    def test_configure_with_none_user_id(self):
        cfg = EobotConfig()
        cfg.configure(user_id=123)
        self.assertEqual(123, cfg._user_id)

        cfg.configure(user_id=None)
        self.assertIsNone(cfg._user_id)
예제 #5
0
    def test_has_password(self):
        cfg = EobotConfig()
        self.assertFalse(cfg.has_password())

        cfg.configure(password="******")
        self.assertTrue(cfg.has_password())

        cfg.configure(password=None)
        self.assertFalse(cfg.has_password())
예제 #6
0
    def test_has_email(self):
        cfg = EobotConfig()
        self.assertFalse(cfg.has_email())

        cfg.configure(email="email")
        self.assertTrue(cfg.has_email())

        cfg.configure(email=None)
        self.assertFalse(cfg.has_email())
예제 #7
0
    def test_has_token(self):
        cfg = EobotConfig()
        self.assertFalse(cfg.has_token())

        cfg.configure(token="token")
        self.assertTrue(cfg.has_token())

        cfg.configure(token=None)
        self.assertFalse(cfg.has_token())
예제 #8
0
    def test_has_user_id(self):
        cfg = EobotConfig()
        self.assertFalse(cfg.has_user_id())

        cfg.configure(user_id=123)
        self.assertTrue(cfg.has_user_id())

        cfg.configure(user_id=None)
        self.assertFalse(cfg.has_user_id())
예제 #9
0
    def test_configure_with_valid_parameters(self):
        cfg = EobotConfig()

        self.assertIsNone(cfg._user_id)
        self.assertIsNone(cfg._email)
        self.assertIsNone(cfg._password)
        self.assertIsNone(cfg._token)

        cfg.configure(user_id=123,
                      email="email",
                      password="******",
                      token="token")

        self.assertEqual(123, cfg._user_id)
        self.assertEqual("email", cfg._email)
        self.assertEqual("password", cfg._password)
        self.assertEqual("token", cfg._token)
예제 #10
0
    def test_configure_set_single_parameter(self):
        cfg = EobotConfig()
        cfg.configure(user_id=123,
                      email="email",
                      password="******",
                      token="token")

        self.assertEqual(123, cfg._user_id)
        self.assertEqual("email", cfg._email)
        self.assertEqual("password", cfg._password)
        self.assertEqual("token", cfg._token)

        cfg.configure(email="otheremail")

        # only email should be changed
        self.assertEqual(123, cfg._user_id)
        self.assertEqual("otheremail", cfg._email)
        self.assertEqual("password", cfg._password)
        self.assertEqual("token", cfg._token)
예제 #11
0
 def test_configure_with_valid_email(self):
     cfg = EobotConfig()
     cfg.configure(email="email")
     self.assertEqual("email", cfg._email)
예제 #12
0
    def test_configure_with_invalid_user_id(self):
        cfg = EobotConfig()

        with self.assertRaises(ValueError):
            # noinspection PyTypeChecker
            cfg.configure(user_id="123")
예제 #13
0
 def test_configure_with_valid_user_id(self):
     cfg = EobotConfig()
     cfg.configure(user_id=123)
     self.assertEqual(123, cfg._user_id)
예제 #14
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)
예제 #15
0
 def test_configure_with_valid_token(self):
     cfg = EobotConfig()
     cfg.configure(token="token")
     self.assertEqual("token", cfg._token)
예제 #16
0
 def test_configure_with_valid_password(self):
     cfg = EobotConfig()
     cfg.configure(password="******")
     self.assertEqual("password", cfg._password)
예제 #17
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)
예제 #18
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)
예제 #19
0
    def test_configure_with_invalid_password(self):
        cfg = EobotConfig()

        with self.assertRaises(ValueError):
            # noinspection PyTypeChecker
            cfg.configure(password=123)
예제 #20
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)