Esempio n. 1
0
 def test_encrypted(self):
     self.db.add(tb_tokens(1, "token123"))
     self.db.commit()
     self.db.close()
     r = self.engine.execute(
         "SELECT refresh_token FROM Tokens WHERE discord_user == 1"
     ).fetchone()[0]
     self.assertNotEqual(r, "token123")
Esempio n. 2
0
 def test_insert(self):
     self.db.add(tb_tokens(1, "token123"))
     self.db.commit()
     self.db.close()
     self.assertEqual(
         "token123",
         self.db.query(tb_tokens).filter(
             tb_tokens.token_id == 1).one().refresh_token)
Esempio n. 3
0
 def setUp(self):
     super().setUp()
     self.db.add(tb_tokens(1, self.refresh_token))
     self.db.commit()
     t: tb_tokens = self.helper_get_row(1)
     if self.get_token() is None:
         self.sso.get_token(t)
         self.set_token(t.token)
     t.token = self.get_token()
     self.db.commit()
 def setUp(self):
     AbstractSSOTesting.AbstractSSOTesting.setUp(self)
     AbstractBotReplyTesting.AbstractBotReplyTesting.setUp(self)
     t = tb_tokens(1, self.refresh_token)
     self.db.add(t)
     self.db.commit()
     self.db.refresh(t)
     self.sso.get_token(t)
     self.mock_replace = EVEsso.get_token_from_auth
     EVEsso.get_token_from_auth = MagicMock(return_value={"refresh_token": t.refresh_token, "access_token": t.token})
     channel = DMChannel.DMChannel(1)
     channel.recipient = User.User(1, "Tester", True)
     self.feed = direct_message(DMChannel.DMChannel(1), self.service)
     self.options: Options_DM = self.feed.linked_options
     self.message = Message.Message(channel, channel.recipient, "Initiation message.")
     self.service.sso = self.sso
     self.db.delete(t)
     self.db.commit()
 def setUp(self):
     super().setUp()
     InsightUtilities.ColumnEncryption()._set_random_key()
     t1 = tb_tokens(1, "NULLTestingToken")
     self.db.add(t1)
     self.db.commit()
     self.db.refresh(t1)
     for i in range(10, 12):
         self.db.add(tb_channels(i))
         self.db.add(tb_discord_tokens(i, t1.token_id))
     self.db.commit()
     self.db.refresh(t1)
     self.mock_sso = EVEsso._get_config
     EVEsso._get_config = MagicMock(return_value=None)
     self.service.sso = EVEsso(self.service)
     self.mock_requests = requests.post
     requests.post = MagicMock(side_effect=InsightExc.databaseError.DatabaseError)
     channel = DMChannel.DMChannel(1)
     channel.recipient = User.User(1, "Tester", True)
     self.feed = direct_message(DMChannel.DMChannel(1), self.service)
     self.options: Options_DM = self.feed.linked_options
     self.message = Message.Message(channel, channel.recipient, "Initiation message.")
Esempio n. 6
0
 def setUp(self):
     super().setUp()
     self.db.add(tb_tokens(1, self.refresh_token))
     self.db.commit()
Esempio n. 7
0
 def test_insert(self):
     self.db.add(tb_tokens(2, "test123"))
     self.db.commit()
     with self.assertRaises(InvalidPaddingError):
         self.db.query(tb_tokens).all()
Esempio n. 8
0
 def setUp(self):
     super().setUp()
     self.db.add(tb_tokens(1, "test123"))
     self.db.commit()
     self.db.close()
     ColumnEncryption()._set_random_key()