-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1431 from mosen/hotfix/unit_test_403_authz
Hotfix/unit test 403 authz
- Loading branch information
Showing
41 changed files
with
308 additions
and
200 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Api; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
|
||
class ModulesController extends Controller | ||
{ | ||
// | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,56 @@ | ||
<?php | ||
|
||
/** @var \Illuminate\Database\Eloquent\Factory $factory */ | ||
$factory->define(\App\Machine::class, function (Faker\Generator $faker) { | ||
namespace Database\Factories; | ||
|
||
$oses = [ | ||
['101206', '16G29'], | ||
['101301', '17B48'], | ||
['101503', '19D76'], | ||
]; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
// Allow standalone | ||
try { | ||
list($modelcode, $machine_name, $machine_model, $machine_desc) = FakerDataStore::get('machine_factory', 'machine'); | ||
} catch (\Throwable $th) { | ||
list($modelcode, $machine_name, $machine_model, $machine_desc) = ['P7QM', 'MacPro', 'MacPro7,1', 'Mac Pro (2019)']; | ||
} | ||
|
||
list($os_version, $build) = $faker->randomElement($oses); | ||
class MachineFactory extends Factory | ||
{ | ||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array | ||
*/ | ||
public function definition() | ||
{ | ||
$oses = [ | ||
['101206', '16G29'], | ||
['101301', '17B48'], | ||
['101503', '19D76'], | ||
]; | ||
|
||
// Allow standalone | ||
// try { | ||
// list($modelcode, $machine_name, $machine_model, $machine_desc) = FakerDataStore::get('machine_factory', 'machine'); | ||
// } catch (\Throwable $th) { | ||
list($modelcode, $machine_name, $machine_model, $machine_desc) = ['P7QM', 'MacPro', 'MacPro7,1', 'Mac Pro (2019)']; | ||
// } | ||
|
||
$computerName = $faker->firstName() . '\'s ' . $machine_name; | ||
list($os_version, $build) = $this->faker->randomElement($oses); | ||
|
||
return [ | ||
'serial_number' => $faker->unique()->regexify('[A-Z0-9]{3}[CDFGHJKLMNPQRSTVWXYZ][123456789CDFGHJKLMNPQRTVWXY][A-Z0-9]{3}P7QM'), | ||
'hostname' => $faker->domainWord() . '.local', | ||
'machine_model' => $machine_model, | ||
'machine_desc' => $machine_desc, | ||
'img_url' => '', | ||
'cpu' => $faker->text, | ||
'current_processor_speed' => $faker->randomFloat(2, 1, 4) . " GHz", | ||
'cpu_arch' => 'x86_64', | ||
'os_version' => $os_version, | ||
'physical_memory' => $faker->randomElement([4,8,16,32]), | ||
'platform_uuid' => $faker->uuid, | ||
'number_processors' => $faker->randomElement([2,4,6,8]), | ||
'SMC_version_system' => $faker->randomFloat(2, 1, 3) . 'f' . $faker->randomDigit, | ||
'boot_rom_version' => $faker->regexify('[IMBP]{2}\.[0-9]{4}\.[A-Z]+'), | ||
'bus_speed' => $faker->randomElement([null, '1.07 Ghz']), | ||
'computer_name' => $computerName, | ||
'l2_cache' => $faker->randomElement([null, '3 MB', '6 MB']), | ||
'machine_name' => $machine_name, | ||
'packages' => 1, | ||
'buildversion' => $build, | ||
]; | ||
}); | ||
$computerName = $this->faker->firstName() . '\'s ' . $machine_name; | ||
|
||
return [ | ||
'serial_number' => $this->faker->unique()->regexify('[A-Z0-9]{3}[CDFGHJKLMNPQRSTVWXYZ][123456789CDFGHJKLMNPQRTVWXY][A-Z0-9]{3}P7QM'), | ||
'hostname' => $this->faker->domainWord() . '.local', | ||
'machine_model' => $machine_model, | ||
'machine_desc' => $machine_desc, | ||
'img_url' => '', | ||
'cpu' => $this->faker->text, | ||
'current_processor_speed' => $this->faker->randomFloat(2, 1, 4) . " GHz", | ||
'cpu_arch' => 'x86_64', | ||
'os_version' => $os_version, | ||
'physical_memory' => $this->faker->randomElement([4,8,16,32]), | ||
'platform_uuid' => $this->faker->uuid, | ||
'number_processors' => $this->faker->randomElement([2,4,6,8]), | ||
'SMC_version_system' => $this->faker->randomFloat(2, 1, 3) . 'f' . $this->faker->randomDigit, | ||
'boot_rom_version' => $this->faker->regexify('[IMBP]{2}\.[0-9]{4}\.[A-Z]+'), | ||
'bus_speed' => $this->faker->randomElement([null, '1.07 Ghz']), | ||
'computer_name' => $computerName, | ||
'l2_cache' => $this->faker->randomElement([null, '3 MB', '6 MB']), | ||
'machine_name' => $machine_name, | ||
'packages' => 1, | ||
'buildversion' => $build, | ||
]; | ||
} | ||
} |
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,21 +1,21 @@ | ||
<?php | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Model Factories | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may define all of your model factories. Model factories give | ||
| you a convenient way to create models for testing and seeding your | ||
| database. Just tell the factory how a default model should look. | ||
| | ||
*/ | ||
namespace Database\Factories; | ||
|
||
/** @var \Illuminate\Database\Eloquent\Factory $factory */ | ||
$factory->define(App\MachineGroup::class, function (Faker\Generator $faker) { | ||
return [ | ||
'name' => $faker->name, | ||
'key' => $faker->uuid, | ||
]; | ||
}); | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
class MachineGroupFactory extends Factory | ||
{ | ||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array | ||
*/ | ||
public function definition() | ||
{ | ||
return [ | ||
'name' => $this->faker->name, | ||
'key' => $this->faker->uuid, | ||
]; | ||
} | ||
} |
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,30 +1,43 @@ | ||
<?php | ||
|
||
/** @var \Illuminate\Database\Eloquent\Factory $factory */ | ||
$factory->define(\App\ReportData::class, function (Faker\Generator $faker) { | ||
namespace Database\Factories; | ||
|
||
$machines = [ | ||
['JYVX', 'Macmini', 'Macmini8,1', 'Mac mini (2018)'], | ||
['HDNK', 'MacBook', 'MacBook9,1', 'MacBook (Retina, 12-inch, Early 2016)'], | ||
['MD6N', 'MacBook Pro', 'MacBookPro16,1', 'MacBook Pro (16-inch, 2019)'], | ||
['H1DP', 'MacBook Pro', 'MacBookPro12,1', 'MacBook Pro (Retina, 13-inch, Early 2015)'], | ||
['J9X6', 'iMac', 'iMac18,3', 'iMac (Retina 5K, 27-inch, 2017)'], | ||
['JWDW', 'iMac', 'iMac19,2', 'iMac (Retina 4K, 21.5-inch, 2019)'], | ||
['P7QM', 'MacPro', 'MacPro7,1', 'Mac Pro (2019)'], | ||
]; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
FakerDataStore::add('machine', $faker->randomElement($machines)); | ||
list($modelcode, $machine_name, $machine_model, $machine_desc) = FakerDataStore::get('reportdata_factory', 'machine'); | ||
class ReportDataFactory extends Factory | ||
{ | ||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array | ||
*/ | ||
public function definition() | ||
{ | ||
$machines = [ | ||
['JYVX', 'Macmini', 'Macmini8,1', 'Mac mini (2018)'], | ||
['HDNK', 'MacBook', 'MacBook9,1', 'MacBook (Retina, 12-inch, Early 2016)'], | ||
['MD6N', 'MacBook Pro', 'MacBookPro16,1', 'MacBook Pro (16-inch, 2019)'], | ||
['H1DP', 'MacBook Pro', 'MacBookPro12,1', 'MacBook Pro (Retina, 13-inch, Early 2015)'], | ||
['J9X6', 'iMac', 'iMac18,3', 'iMac (Retina 5K, 27-inch, 2017)'], | ||
['JWDW', 'iMac', 'iMac19,2', 'iMac (Retina 4K, 21.5-inch, 2019)'], | ||
['P7QM', 'MacPro', 'MacPro7,1', 'Mac Pro (2019)'], | ||
]; | ||
|
||
return [ | ||
'serial_number' => $faker->unique()->regexify('[A-Z0-9]{3}[CDFGHJKLMNPQRSTVWXYZ][123456789CDFGHJKLMNPQRTVWXY][A-Z0-9]{3}') .$modelcode, | ||
'console_user' => $faker->userName, | ||
'long_username' => $faker->name, | ||
'remote_ip' => $faker->ipv4, | ||
'uptime' => $faker->numberBetween(0, 1000000), | ||
'reg_timestamp' => $faker->dateTimeBetween('-4 years')->format('U'), | ||
'machine_group' => 0, | ||
'archive_status' => $faker->numberBetween(0, 1), | ||
'timestamp' =>$faker->dateTimeBetween('-2 months')->format('U'), | ||
]; | ||
}); | ||
// FakerDataStore::add('machine', $this->faker->randomElement($machines)); | ||
// list($modelcode, $machine_name, $machine_model, $machine_desc) = FakerDataStore::get('reportdata_factory', 'machine'); | ||
|
||
$machine = $this->faker->randomElement($machines); | ||
list($modelcode, $machine_name, $machine_model, $machine_desc) = $machine; | ||
return [ | ||
'serial_number' => $this->faker->unique()->regexify('[A-Z0-9]{3}[CDFGHJKLMNPQRSTVWXYZ][123456789CDFGHJKLMNPQRTVWXY][A-Z0-9]{3}') .$modelcode, | ||
'console_user' => $this->faker->userName, | ||
'long_username' => $this->faker->name, | ||
'remote_ip' => $this->faker->ipv4, | ||
'uptime' => $this->faker->numberBetween(0, 1000000), | ||
'reg_timestamp' => $this->faker->dateTimeBetween('-4 years')->format('U'), | ||
'machine_group' => 0, | ||
'archive_status' => $this->faker->numberBetween(0, 1), | ||
'timestamp' =>$this->faker->dateTimeBetween('-2 months')->format('U'), | ||
]; | ||
} | ||
} |
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,14 +1,21 @@ | ||
<?php | ||
|
||
/** @var \Illuminate\Database\Eloquent\Factory $factory */ | ||
namespace Database\Factories; | ||
|
||
use App\UserContactMethod; | ||
use Faker\Generator as Faker; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
$factory->define( | ||
UserContactMethod::class, function (Faker $faker) { | ||
return [ | ||
"channel" => "mail", | ||
"address" => $faker->email, | ||
]; | ||
}); | ||
class UserContactMethodFactory extends Factory | ||
{ | ||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array | ||
*/ | ||
public function definition() | ||
{ | ||
return [ | ||
"channel" => "mail", | ||
"address" => $this->faker->email, | ||
]; | ||
} | ||
} |
Oops, something went wrong.