-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
260ce3c
commit 4168263
Showing
10 changed files
with
138 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import server.MongoDB; | ||
import com.mongodb.client.MongoClient; | ||
import com.mongodb.client.MongoClients; | ||
import com.mongodb.client.MongoCollection; | ||
import com.mongodb.client.MongoDatabase; | ||
|
||
import org.bson.Document; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static com.mongodb.client.model.Filters.eq; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
public class AutoLoginTest { | ||
private static MongoClient mongoClient; | ||
private static MongoDatabase PantryPalDB; | ||
|
||
@BeforeAll | ||
public static void setUp() { | ||
String testUri = "mongodb+srv://sraswan:[email protected]/?retryWrites=true&w=majority"; | ||
mongoClient = MongoClients.create(testUri); | ||
PantryPalDB = mongoClient.getDatabase("PantryPal"); | ||
} | ||
|
||
@Test | ||
public void testAutoLoginSuccess() { | ||
String username = "test"; | ||
String password = "password"; | ||
String userID = server.Account.loginAccount(username, password, false); | ||
assertNotNull((userID)); | ||
} | ||
|
||
@Test | ||
public void testAutoLoginUnsuccessful() { | ||
String username = "testuser"; | ||
String password = "testpasswordd"; | ||
String userID = server.Account.loginAccount(username, password, false); | ||
assertEquals(userID, null); | ||
} | ||
|
||
@Test | ||
public void testLoginE2E() { | ||
testAutoLoginSuccess(); | ||
testAutoLoginUnsuccessful(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters