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

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

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