Skip to content

Commit

Permalink
Added Argparse
Browse files Browse the repository at this point in the history
  • Loading branch information
TheManWhoLikesToCode committed Jan 15, 2024
1 parent 10b5c83 commit e3d7766
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/Unit-Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ jobs:
- name: Run tests
run: |
python backend/test_blackboard_scraper.py
python backend/test_blackboard_scraper.py ${{ secrets.TEST_USERNAME }} ${{ secrets.TEST_PASSWORD }}
17 changes: 14 additions & 3 deletions backend/test_blackboard_scraper.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import argparse
import os
import random
import time
import unittest

from dotenv import load_dotenv
from blackboard_scraper import BlackboardSession
from unittest.mock import MagicMock, patch
from unittest.mock import patch
from usernames import usernames

# Create the parser
parser = argparse.ArgumentParser(description='Test BlackboardSession')

# Add the arguments
parser.add_argument('--username', type=str, help='Username for login')
parser.add_argument('--password', type=str, help='Password for login')

# Parse the arguments
args = parser.parse_args()

""""
Test Case Senarios:
Expand Down Expand Up @@ -64,8 +75,8 @@ class TestBlackboardSession(unittest.TestCase):

def setUp(self):
load_dotenv()
self.username = os.getenv('TEST_USERNAME')
self.password = os.getenv('TEST_PASSWORD')
self.username = args.username if args.username else os.getenv('TEST_USERNAME')
self.password = args.password if args.password else os.getenv('TEST_PASSWORD')

# * Login Tests *#

Expand Down

0 comments on commit e3d7766

Please sign in to comment.