MCPcopy Index your code
hub / github.com/diffgram/diffgram / mock_decryption

Method mock_decryption

shared/connection/test_connection.py:22–58  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

20
21
22 def mock_decryption(self):
23
24 import difflib
25
26 connection_id = 10
27
28 connection_operations = Connection_Operations(
29 session = self.session,
30 connection_id = connection_id
31 )
32
33 connection_operations.get_existing_connection(connection_id)
34
35 print(connection_operations.connection.private_secret_encrypted)
36
37 decrypted_secret = connection_operations.get_secret()
38
39 assert connection_operations.connection.private_secret_encrypted != decrypted_secret
40
41 sandbox_key = "\n"
42 def diff(a, b):
43 for i,s in enumerate(difflib.ndiff(a, b)):
44 if s[0]==' ': continue
45 elif s[0]=='-':
46 print(f'Delete "{s[-1]}" from position {i}')
47 elif s[0]=='+':
48 print(f'Add "{s[-1]}" to position {i}')
49
50 # Diff falsely fails here....
51
52 #diff(decrypted_secret, sandbox_key)
53 # https://stackoverflow.com/questions/46280148/python-3-x-dont-count-carriage-returns-with-len
54 # assert with carraige returns?
55
56 print(len(decrypted_secret), len(sandbox_key))
57 assert decrypted_secret == sandbox_key
58 #assert decrypted_secret == "test"
59
60
61

Callers 1

testFunction · 0.95

Calls 3

get_secretMethod · 0.95

Tested by

no test coverage detected