Skip to content

Commit

Permalink
Refactored Behave
Browse files Browse the repository at this point in the history
Split file base test into feature based tests :D
  • Loading branch information
TheManWhoLikesToCode committed Jan 23, 2024
1 parent ec67bf1 commit a6fb612
Show file tree
Hide file tree
Showing 10 changed files with 158 additions and 128 deletions.
16 changes: 16 additions & 0 deletions backend/features/bb_session_enable_instructors_and_time.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Feature: Blackboard Session - Enable Insturctors and Time
In order to correctly name courses
As a system
I want to enable instructors and course season

Scenario: Enable instructors when logged in
Given I have valid credentials
And I am logged in
When I enable instructors
Then the enable instructors response should be "Instructors enabled"

Scenario: Enable instructors when not logged in
Given I have invalid username and password
And I am not logged in
When I enable instructors
Then the enable instructors response should be "Not logged in."
16 changes: 16 additions & 0 deletions backend/features/bb_session_get_courses.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Feature: Blackboard Session - Get Courses
In order to archive courses for the user
As a system
I want to get courses

Scenario: Get courses when logged in
Given I have valid credentials
And I am logged in
When I get courses
Then the get courses response should be "Courses retrieved"

Scenario: Get courses when not logged in
Given I have invalid username and password
And I am not logged in
When I get courses
Then the get courses response should be "Not logged in."
16 changes: 16 additions & 0 deletions backend/features/bb_session_get_download_tasks.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Feature: Blackboard Session - Get Download Tasks
In order to return the courses to the user
As a system
I want to get the download tasks

Scenario: Get download tasks when logged in
Given I have valid credentials
And I am logged in
When I get download tasks
Then the get download tasks response should be "Download tasks retrieved"

Scenario: Get download tasks when not logged in
Given I have invalid username and password
And I am not logged in
When I get download tasks
Then the get download tasks response should be "Not logged in."
20 changes: 20 additions & 0 deletions backend/features/bb_session_login.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Feature: Blackboard Session - Login
In order to access Blackboard
As a system
I want to login

Scenario: Valid credentials login
Given I have valid credentials
When I login
Then the response should be "Login successful."

Scenario: Invalid both username and password
Given I have invalid username and password
When I login
Then the response should be "The username you entered cannot be identified."

Scenario: I attempt to login when already logged in
Given I have valid credentials
And I am logged in
When I login
Then the response should be "Already logged in."
15 changes: 15 additions & 0 deletions backend/features/bb_session_manager_creating_sessions.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Blackboard Sesssion Manager - Creating a new session for a user
In order to use blackboard
As a user
I want to create a new session

Scenario: Creating a new blackboard session for a user
Given a blackboard session manager
When I request a session for user "Alice"
Then a new session should be created for "Alice"

Scenario: Storing a blackboard session for a user
Given a blackboard session manager
And a blackboard session for user "Charlie"
When I store the session for user "Charlie"
Then the session for "Charlie" should be stored in the manager
27 changes: 27 additions & 0 deletions backend/features/bb_session_manager_deleting_sessions.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Feature: Blackboard Session Manager - Deleting Sessions
In order to correctly delete user data
As a system
I want to delete blackboard sessions

Scenario: Deleting a blackboard session for a user
Given a blackboard session manager
And an existing session for user "Eve"
When I delete the session for user "Eve"
Then the session for "Eve" should be removed

Scenario: Cleaning up inactive sessions
Given a blackboard session manager
And inactive sessions older than 3600 seconds
When I clean up inactive sessions
Then all sessions older than 3600 seconds should be removed

Scenario: Attempting to delete a session for a non-existent user
Given a blackboard session manager
When I delete the session for user "NonExistentUser"
Then no session should be removed

Scenario: Cleaning up with no inactive sessions
Given a blackboard session manager
And no inactive sessions
When I clean up inactive sessions
Then no session should be removed
10 changes: 10 additions & 0 deletions backend/features/bb_session_manager_modifying_sessions.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Feature: Blackboard session management - Modifying users sessions
In order to modify users sessions to keep them alive
As a blackboard administrator
I want to be able to modify users sessions

Scenario: Updating the last activity time of a session
Given a blackboard session manager
And an existing session for user "George"
When I update the last activity time for "George"'s session
Then the last activity time for "George"'s session should be updated
38 changes: 38 additions & 0 deletions backend/features/bb_session_manager_retrieving_sessions.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Feature: Blackboard Session Manager: Retrieving a session
In order to keep track of users
As a system
I want to be able to retrieve a blackboard session for a user

Scenario: Retrieving an existing blackboard session for a user
Given a blackboard session manager
And an existing session for user "Bob"
When I request a session for user "Bob"
Then the existing session for "Bob" should be returned

Scenario: Retrieving a blackboard session by username
Given a blackboard session manager
And an existing session for user "David"
When I retrieve a session by username "David"
Then the session for "David" should be returned

Scenario: Retrieving a blackboard session by session ID
Given a blackboard session manager
And an existing session with ID "session123"
When I retrieve a session by session ID "session123"
Then the session with ID "session123" should be returned

Scenario: Attempting to retrieve a session for a non-existent user
Given a blackboard session manager
When I retrieve a session by username "NonExistentUser"
Then no session should be returned

Scenario: Attempting to retrieve a session with a non-existent session ID
Given a blackboard session manager
When I retrieve a session by session ID "nonExistentSession123"
Then no session should be returned

Scenario: Multiple users sharing the same session ID
Given a blackboard session manager
And an existing session with ID "sharedSession123" for users "Harry" and "Irene"
When I retrieve a session by session ID "sharedSession123"
Then the same session should be returned for both "Harry" and "Irene"
53 changes: 0 additions & 53 deletions backend/features/blackboard_session.feature

This file was deleted.

75 changes: 0 additions & 75 deletions backend/features/blackboard_session_manager.feature

This file was deleted.

0 comments on commit a6fb612

Please sign in to comment.