forked from NashTech-Labs/mycellwasstolen
-
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.
NashTech-Labs#27 NashTech-Labs#14 Unit test cases were re-factored wi…
…th respect to all code refactoring in controllers and repositories
- Loading branch information
1 parent
468aba9
commit 61cbdba
Showing
9 changed files
with
106 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
@(message: String) | ||
@main("Welcome to Play",user=None) { | ||
|
||
<div > | ||
<div class ="container"> | ||
<div class="page"> | ||
<h3>Page Not Found</h3> | ||
<h1> 404: Page Not Found</h1> | ||
<a class="navbar-brand" href="/">MCWS Home</a> | ||
</div> | ||
</div> | ||
} |
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 |
---|---|---|
|
@@ -21,11 +21,11 @@ import model.repository.AuditRepository | |
class RouterTest extends Specification { | ||
|
||
val date = new java.sql.Date(new java.util.Date().getTime()) | ||
val brand = Brand("nokia", "12-17-2013") | ||
val brand = Brand("nokia") | ||
val model = Model("E5", 1) | ||
val mobileUser = Mobile( | ||
"sushil", 1, 1, "864465028854206", "864465028854206", "12-05-2013", "+91 8375919908", | ||
"[email protected]", "stolen", Status.pending, "test", "12-17-2013", "sushil.png", "nokia", "E5") | ||
"sushil", 1, 1, "864465028854206", "864465028854206", new java.sql.Date(new java.util.Date().getTime()), "+91 8375919908", | ||
"[email protected]", "stolen", Status.pending, "test", new java.sql.Date(new java.util.Date().getTime()), "sushil.png", "nokia", "E5") | ||
|
||
"respond to the index Action" in { | ||
running(FakeApplication()) { | ||
|
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 |
---|---|---|
|
@@ -9,36 +9,39 @@ import play.api.Play.current | |
import play.api.cache.Cache | ||
import play.api.test.FakeApplication | ||
import play.api.test.Helpers._ | ||
import utils.Common | ||
import utils.StatusUtil.Status | ||
import play.api.test.FakeRequest | ||
import play.api.mvc.Security | ||
import java.util.Date | ||
import utils.S3UtilComponent | ||
import utils.MailUtil | ||
import java.util.Calendar | ||
|
||
class AdminControllerTestCases extends Specification with Mockito { | ||
|
||
val stolenMobileUser = Mobile( | ||
"sushil", 1, 1, "864465028854206", "123456789012677", "12-05-2013", "+91 9839839830", | ||
"[email protected]", "stolen", Status.pending, "test", "12-17-2013", "gaurav.png", "nokia", "E5") | ||
"sushil", 1, 1, "864465028854206", "123456789012677", new java.sql.Date(new java.util.Date().getTime()), "+91 9839839830", | ||
"[email protected]", "stolen", Status.pending, "test", new java.sql.Date(new java.util.Date().getTime()), "gaurav.png", "nokia", "E5") | ||
|
||
val stolenMobileUser1 = Mobile( | ||
"sushil", 1, 1, "864465028854206", "123456789012677", "12-05-2013", "+91 9839839830", | ||
"[email protected]", "Clean", Status.pending, "test", "12-17-2013", "gaurav.png", "nokia", "E5") | ||
"sushil", 1, 1, "864465028854206", "123456789012677", new java.sql.Date(new java.util.Date().getTime()), "+91 9839839830", | ||
"[email protected]", "Clean", Status.pending, "test", new java.sql.Date(new java.util.Date().getTime()), "gaurav.png", "nokia", "E5") | ||
|
||
val cleanMobileUser = Mobile( | ||
"sushil", 1, 1, "12345678901234", "123456789012678", "12-05-2013", "+91 9839839830", | ||
"[email protected]", "Clean", Status.pending, "test", "12-17-2013", "gaurav.png", "nokia", "E5") | ||
"sushil", 1, 1, "12345678901234", "123456789012678", new java.sql.Date(new java.util.Date().getTime()), "+91 9839839830", | ||
"[email protected]", "Clean", Status.pending, "test", new java.sql.Date(new java.util.Date().getTime()), "gaurav.png", "nokia", "E5") | ||
|
||
val mobileWithBrand = (Mobile( | ||
"gs", 1, 1, "864465028854206", "123456789012677", "12-05-2013", "+91 9839839830", | ||
"[email protected]", "stolen", Status.pending, "test", "12-17-2013", "gaurav.png", "nokia", "E5"), "nokia", "E5") | ||
"gs", 1, 1, "864465028854206", "123456789012677", new java.sql.Date(new java.util.Date().getTime()), "+91 9839839830", | ||
"[email protected]", "stolen", Status.pending, "test", new java.sql.Date(new java.util.Date().getTime()), "gaurav.png", "nokia", "E5"), "nokia", "E5") | ||
|
||
val getAllMobilesWithBrand: List[(Mobile, String, String)] = List(mobileWithBrand) | ||
val audit = List(Audit("864465028854206", "12-05-2013", Some(1))) | ||
val calender = Calendar.getInstance | ||
val now:java.util.Date = calender.getTime | ||
val timeStamp = new java.sql.Timestamp(now.getTime()) | ||
val audit = List(Audit("864465028854206", timeStamp , Some(1))) | ||
val user = User("admin", "knol2013") | ||
|
||
val mockedMail = mock[Common] | ||
val mockedMail = mock[MailUtil] | ||
val mockedS3Util = mock[S3UtilComponent] | ||
val mockedMobilRepo = mock[MobileRepository] | ||
val mockedAuditRepo = mock[AuditRepository] | ||
|
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 |
---|---|---|
|
@@ -12,7 +12,6 @@ import play.api.test.FakeRequest | |
import play.api.test.Helpers._ | ||
import model.repository._ | ||
import utils.StatusUtil.Status | ||
import utils.Common | ||
import utils.S3UtilComponent | ||
import play.api.mvc.Request | ||
import play.api.mvc.MultipartFormData | ||
|
@@ -23,11 +22,14 @@ import play.api.mvc.MultipartFormData.BadPart | |
import play.api.mvc.MultipartFormData.MissingFilePart | ||
import play.api.test.FakeHeaders | ||
import play.mvc.Result | ||
import utils.MailUtil | ||
import java.util.Calendar | ||
import utils.CommonUtils | ||
|
||
class MobileControllerTestCases extends Specification with Mockito { | ||
|
||
val date = new java.sql.Date(new java.util.Date().getTime()) | ||
val newbrand = Brand("nokia", "12-17-2013", Some(1)) | ||
val newbrand = Brand("nokia", Some(1)) | ||
val brand = List(newbrand) | ||
val brandById: Option[Brand] = Some(newbrand) | ||
val newmodel = Model("N72", 1) | ||
|
@@ -37,18 +39,22 @@ class MobileControllerTestCases extends Specification with Mockito { | |
val username = "admin" | ||
|
||
val mobileUser = Mobile( | ||
"sushil", 1, 1, "864465028854206", "864465028854206", "12-03-2013", "+91 8375919908", | ||
"[email protected]", "stolen", Status.pending, "test", "12-17-2015", "ss.png", "nokia", "E5") | ||
"sushil", 1, 1, "864465028854206", "864465028854206", new java.sql.Date(new java.util.Date().getTime()), "+91 8375919908", | ||
"[email protected]", "stolen", Status.pending, "test", new java.sql.Date(new java.util.Date().getTime()), "ss.png", "nokia", "E5") | ||
|
||
val timestamp = new Audit("864465028854206", "12-17-2015", Some(1)) | ||
val calender = Calendar.getInstance | ||
val now: java.util.Date = calender.getTime | ||
val timeStamp = new java.sql.Timestamp(now.getTime()) | ||
val timestamp = new Audit("864465028854206", timeStamp, Some(1)) | ||
|
||
val mockedMail = mock[Common] | ||
val mockedMail = mock[MailUtil] | ||
val s3util = mock[S3UtilComponent] | ||
val mockedMobileRepo = mock[MobileRepository] | ||
val mockedBrandRepo = mock[BrandRepository] | ||
val mockedModelRepo = mock[ModelRepository] | ||
val mockedAuditRepo = mock[AuditRepository] | ||
val mobileController = new MobileController(mockedMobileRepo, mockedBrandRepo, mockedModelRepo, mockedAuditRepo, mockedMail, s3util) | ||
val mockedCommonUtils = mock[CommonUtils] | ||
val mobileController = new MobileController(mockedMobileRepo, mockedBrandRepo, mockedModelRepo, mockedAuditRepo, mockedMail, s3util,mockedCommonUtils) | ||
|
||
"MobileControllerTesting: mobileRegistrationForm" in { | ||
running(FakeApplication()) { | ||
|
@@ -98,7 +104,7 @@ class MobileControllerTestCases extends Specification with Mockito { | |
"mobileModelId" -> Seq("1"), | ||
"imeiMeid" -> Seq("123456789012347"), | ||
"otherImeiMeid" -> Seq("1234"), | ||
"purchaseDate" -> Seq("12-12-2012"), | ||
"purchaseDate" -> Seq("2012-12-12"), | ||
"contactNo" -> Seq("9958324567"), | ||
"email" -> Seq("[email protected]"), | ||
"regType" -> Seq("pending"), | ||
|
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
Oops, something went wrong.