Skip to content

Commit

Permalink
Fixup the mock for tests.
Browse files Browse the repository at this point in the history
No-Issue

Signed-off-by: James Tanner <[email protected]>
  • Loading branch information
jctanner committed Aug 29, 2023
1 parent 6d6bc14 commit c808697
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions profiles/community/github_mock/flaskapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def set_session(sid, uid):
def get_access_token_by_id(sid):
conn = sqlite3.connect(db_name)
cursor = conn.cursor()
cursor.execute('SELECT access_token,uid FROM access_tokens WHERE id = ?', (sid,))
cursor.execute('SELECT access_token,uid FROM access_tokens WHERE access_token = ?', (sid,))
row = cursor.fetchone()
rsid = row[0]
userid = row[1]
Expand All @@ -201,7 +201,7 @@ def set_access_token(token, uid):
conn = sqlite3.connect(db_name)
cursor = conn.cursor()
cursor.execute(
'INSERT into access_tokens (id, uid) VALUES (?, ?)',
'INSERT into access_tokens (access_token, uid) VALUES (?, ?)',
(token, uid)
)
conn.commit()
Expand All @@ -222,7 +222,7 @@ def delete_access_token(token):
def get_csrf_token_by_id(sid):
conn = sqlite3.connect(db_name)
cursor = conn.cursor()
cursor.execute('SELECT csrf_token,uid FROM access_tokens WHERE id = ?', (sid,))
cursor.execute('SELECT csrf_token,uid FROM access_tokens WHERE csrf_token = ?', (sid,))
row = cursor.fetchone()
rsid = row[0]
userid = row[1]
Expand Down Expand Up @@ -298,7 +298,9 @@ def do_access_token():
# client_secret = ds['client_secret']

# Match the acces_code to the username and invalidate it
username = ACCESS_TOKENS[access_code]
#username = ACCESS_TOKENS[access_code]
_at = get_access_token_by_id(access_code)
udata = get_user_by_id(_at['uid'])
# ACCESS_TOKENS.pop(access_code, None)
delete_access_token(access_code)

Expand Down

0 comments on commit c808697

Please sign in to comment.