Example #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)
Example #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)
Example #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)
Example #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)
Example #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())
Example #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())
Example #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())
Example #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())
Example #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)
Example #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)
Example #11
0
 def test_configure_with_valid_email(self):
     cfg = EobotConfig()
     cfg.configure(email="email")
     self.assertEqual("email", cfg._email)
Example #12
0
    def test_configure_with_invalid_user_id(self):
        cfg = EobotConfig()

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

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