From 816affc83bce402c7c8d2024321e50d1f8ad7e3b Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 15 Dec 2016 15:14:00 -0800 Subject: [PATCH] Tests updated for #3066 --- .env.tests | 8 ++++++++ tests/functional.suite.yml | 6 +++--- tests/functional/AccessoriesCest.php | 8 ++++---- tests/functional/AssetModelsCest.php | 2 +- tests/functional/AssetsCest.php | 6 +++--- tests/functional/ConsumablesCest.php | 2 +- tests/functional/LicensesCest.php | 13 +++++-------- tests/functional/LocationsCest.php | 11 ++--------- 8 files changed, 27 insertions(+), 29 deletions(-) diff --git a/.env.tests b/.env.tests index 6349562fbf..1d09bfbb85 100644 --- a/.env.tests +++ b/.env.tests @@ -7,3 +7,11 @@ DB_DATABASE=snipeittests DB_USERNAME=snipeit DB_PASSWORD=snipe APP_KEY=base64:tu9NRh/a6+dCXBDGvg0Gv/0TcABnFsbT4AKxrr8mwQo= + + +# -------------------------------------------- +# OPTIONAL: LOGIN THROTTLING +# (LOGIN_LOCKOUT_DURATIONin minutes) +# -------------------------------------------- +LOGIN_MAX_ATTEMPTS=1000000 +LOGIN_LOCKOUT_DURATION=100000000 diff --git a/tests/functional.suite.yml b/tests/functional.suite.yml index 903177403e..553fa9d2b5 100644 --- a/tests/functional.suite.yml +++ b/tests/functional.suite.yml @@ -6,7 +6,7 @@ class_name: FunctionalTester modules: - enabled: + enabled: # add framework module here - \Helper\Functional - Laravel5: @@ -14,8 +14,8 @@ modules: cleanup: false - Db: dsn: 'mysql:host=localhost;dbname=snipeittests' - user: 'snipeit' - password: 'snipe' + user: 'snipeit_laravel' + password: '' dump: tests/_data/dump.sql populate: true cleanup: false diff --git a/tests/functional/AccessoriesCest.php b/tests/functional/AccessoriesCest.php index a3087becd7..e0d5c5d828 100644 --- a/tests/functional/AccessoriesCest.php +++ b/tests/functional/AccessoriesCest.php @@ -16,7 +16,7 @@ class AccessoriesCest { $I->wantTo('ensure that the create accessories form loads without errors'); $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage('/admin/accessories/create'); + $I->amOnPage('/accessories/create'); $I->dontSee('Create Accessory', '.page-header'); $I->see('Create Accessory', 'h1.pull-left'); } @@ -24,7 +24,7 @@ class AccessoriesCest public function failsEmptyValidation(FunctionalTester $I) { $I->wantTo("Test Validation Fails with blank elements"); - $I->amOnPage('/admin/accessories/create'); + $I->amOnPage('/accessories/create'); $I->click('Save'); $I->seeElement('.alert-danger'); $I->see('The name field is required.', '.alert-msg'); @@ -35,7 +35,7 @@ class AccessoriesCest public function failsShortValidation(FunctionalTester $I) { $I->wantTo("Test Validation Fails with short name"); - $I->amOnPage('/admin/accessories/create'); + $I->amOnPage('/accessories/create'); $I->fillField('name', 't2'); $I->fillField('qty', '-15'); $I->fillField('min_amt', '-15'); @@ -64,7 +64,7 @@ class AccessoriesCest ]; $I->wantTo("Test Validation Succeeds"); - $I->amOnPage('/admin/accessories/create'); + $I->amOnPage('/accessories/create'); $I->submitForm('form#create-form', $values); $I->seeRecord('accessories', $values); diff --git a/tests/functional/AssetModelsCest.php b/tests/functional/AssetModelsCest.php index f33772d6bd..3b33003cb1 100644 --- a/tests/functional/AssetModelsCest.php +++ b/tests/functional/AssetModelsCest.php @@ -57,7 +57,7 @@ class AssetModelsCest { $I->wantTo('Ensure I can delete an asset model'); // 6 is the only one without an assigned asset. This is fragile. - $I->amOnPage(route('delete/model', $I->getEmptyModelId())); + $I->amOnPage(route('models.destroy', $I->getEmptyModelId())); $I->seeElement('.alert-success'); } diff --git a/tests/functional/AssetsCest.php b/tests/functional/AssetsCest.php index a19067fffe..8128b24004 100644 --- a/tests/functional/AssetsCest.php +++ b/tests/functional/AssetsCest.php @@ -15,7 +15,7 @@ class AssetsCest { $I->wantTo('ensure that the create assets form loads without errors'); $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage('/hardware/create'); + $I->amOnPage(route('hardware.create')); $I->dontSee('Create Asset', '.page-header'); $I->see('Create Asset', 'h1.pull-left'); } @@ -51,6 +51,7 @@ class AssetsCest 'rtd_location_id' => $asset->rtd_location_id, 'requestable' => $asset->requestable, ]; + print_r($values); $I->wantTo("Test Validation Succeeds"); $I->amOnPage(route('hardware.create')); $I->submitForm('form#create-form', $values); @@ -61,8 +62,7 @@ class AssetsCest public function allowsDelete(FunctionalTester $I) { $I->wantTo('Ensure I can delete an asset'); - $I->amOnPage(route('delete/hardware', $I->getAssetId())); + $I->amOnPage(route('hardware.destroy', $I->getAssetId())); $I->seeElement('.alert-success'); } } - \ No newline at end of file diff --git a/tests/functional/ConsumablesCest.php b/tests/functional/ConsumablesCest.php index 8d600634d7..f865fce9d4 100644 --- a/tests/functional/ConsumablesCest.php +++ b/tests/functional/ConsumablesCest.php @@ -62,7 +62,7 @@ class ConsumablesCest 'min_amt' => $consumable->min_amt, ]; $I->wantTo("Test Validation Succeeds"); - $I->amOnPage(route('consumables.index')); + $I->amOnPage(route('consumables.create')); $I->submitForm('form#create-form', $values); $I->seeRecord('consumables', $values); $I->seeElement('.alert-success'); diff --git a/tests/functional/LicensesCest.php b/tests/functional/LicensesCest.php index 3bc523df60..7a049ae154 100644 --- a/tests/functional/LicensesCest.php +++ b/tests/functional/LicensesCest.php @@ -18,7 +18,7 @@ class licensesCest { $I->wantTo('ensure that the create licenses form loads without errors'); $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('create/licenses')); + $I->amOnPage(route('licenses.create')); $I->dontSee('Create License', '.page-header'); $I->see('Create License', 'h1.pull-left'); } @@ -26,25 +26,22 @@ class licensesCest public function failsEmptyValidation(FunctionalTester $I) { $I->wantTo("Test Validation Fails with blank elements"); - $I->amOnPage(route('create/licenses')); + $I->amOnPage(route('licenses.create')); $I->click('Save'); $I->seeElement('.alert-danger'); $I->see('The name field is required.', '.alert-msg'); - $I->see('The serial field is required.', '.alert-msg'); $I->see('The seats field is required.', '.alert-msg'); } public function failsShortValidation(FunctionalTester $I) { $I->wantTo("Test Validation Fails with short name"); - $I->amOnPage(route('create/licenses')); + $I->amOnPage(route('licenses.create')); $I->fillField('name', 't2'); - $I->fillField('serial', '13a-'); $I->fillField('seats', '-15'); $I->click('Save'); $I->seeElement('.alert-danger'); $I->see('The name must be at least 3 characters', '.alert-msg'); - $I->see('The serial must be at least 5 characters', '.alert-msg'); $I->see('The seats must be at least 1', '.alert-msg'); } @@ -72,7 +69,7 @@ class licensesCest ]; $I->wantTo("Test Validation Succeeds"); - $I->amOnPage(route('create/licenses')); + $I->amOnPage(route('licenses.create')); $I->submitForm('form#create-form', $values); $I->seeRecord('licenses', $values); $I->dontSee('<span class="'); @@ -82,7 +79,7 @@ class licensesCest public function allowsDelete(FunctionalTester $I) { $I->wantTo('Ensure I can delete a license'); - $I->amOnPage(route('delete/license', License::doesntHave('assignedUsers')->first()->id)); + $I->amOnPage(route('licenses.destroy', License::doesntHave('assignedUsers')->first()->id)); $I->seeElement('.alert-success'); } diff --git a/tests/functional/LocationsCest.php b/tests/functional/LocationsCest.php index a5d233df3a..c6b3ff4dbc 100644 --- a/tests/functional/LocationsCest.php +++ b/tests/functional/LocationsCest.php @@ -38,17 +38,10 @@ class LocationsCest { $I->wantTo("Test Validation Fails with short values"); $I->amOnPage(route('create/location')); - $I->fillField('name', 't2'); - $I->fillField('address', 't2da'); - $I->fillField('city', 't2'); - $I->fillField('state', 't'); - $I->fillField('zip', 't2'); + $I->fillField('name', 't'); $I->click('Save'); $I->seeElement('.alert-danger'); - $I->see('The name must be at least 3 characters', '.alert-msg'); - $I->see('The address must be at least 5 characters', '.alert-msg'); - $I->see('The city must be at least 3 characters', '.alert-msg'); - $I->see('The zip must be at least 3 characters', '.alert-msg'); + $I->see('The name must be at least 2 characters', '.alert-msg'); } public function passesCorrectValidation(FunctionalTester $I) {