Skip user tests in Github Actions

This commit is contained in:
David Bomba 2021-05-28 19:39:22 +10:00
parent 28fc672a26
commit 15ce58618b

View File

@ -54,6 +54,10 @@ class UserTest extends TestCase
ThrottleRequests::class, ThrottleRequests::class,
PasswordProtection::class PasswordProtection::class
); );
if (config('ninja.testvars.travis') !== false) {
$this->markTestSkipped('Skip test for Travis');
}
} }
public function testUserList() public function testUserList()
@ -95,54 +99,54 @@ class UserTest extends TestCase
$this->assertNotNull($arr['data']['company_user']); $this->assertNotNull($arr['data']['company_user']);
} }
// public function testUserAttachAndDetach() public function testUserAttachAndDetach()
// { {
// $this->withoutMiddleware(PasswordProtection::class); $this->withoutMiddleware(PasswordProtection::class);
// $user = UserFactory::create($this->account->id); $user = UserFactory::create($this->account->id);
// $user->first_name = 'Test'; $user->first_name = 'Test';
// $user->last_name = 'Palloni'; $user->last_name = 'Palloni';
// $user->email = $this->default_email; $user->email = $this->default_email;
// $user->save(); $user->save();
// $data = $user->toArray(); $data = $user->toArray();
// $response = false; $response = false;
// try { try {
// $response = $this->withHeaders([ $response = $this->withHeaders([
// 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-SECRET' => config('ninja.api_secret'),
// 'X-API-TOKEN' => $this->token, 'X-API-TOKEN' => $this->token,
// 'X-API-PASSWORD' => 'ALongAndBriliantPassword', 'X-API-PASSWORD' => 'ALongAndBriliantPassword',
// ])->post('/api/v1/users?include=company_user', $data); ])->post('/api/v1/users?include=company_user', $data);
// } catch (ValidationException $e) { } catch (ValidationException $e) {
// $message = json_decode($e->validator->getMessageBag(), 1); $message = json_decode($e->validator->getMessageBag(), 1);
// nlog($message); nlog($message);
// var_dump($message); var_dump($message);
// $this->assertNotNull($message); $this->assertNotNull($message);
// } }
// $response->assertStatus(200); $response->assertStatus(200);
// // $this->assertNotNull($user->company_user); // $this->assertNotNull($user->company_user);
// // $this->assertEquals($user->company_user->company_id, $this->company->id); // $this->assertEquals($user->company_user->company_id, $this->company->id);
// $response = $this->withHeaders([ $response = $this->withHeaders([
// 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-SECRET' => config('ninja.api_secret'),
// 'X-API-TOKEN' => $this->token, 'X-API-TOKEN' => $this->token,
// 'X-API-PASSWORD' => 'ALongAndBriliantPassword', 'X-API-PASSWORD' => 'ALongAndBriliantPassword',
// ])->delete('/api/v1/users/'.$this->encodePrimaryKey($user->id).'/detach_from_company?include=company_user'); ])->delete('/api/v1/users/'.$this->encodePrimaryKey($user->id).'/detach_from_company?include=company_user');
// $response->assertStatus(200); $response->assertStatus(200);
// $cu = CompanyUser::whereUserId($user->id)->whereCompanyId($this->company->id)->first(); $cu = CompanyUser::whereUserId($user->id)->whereCompanyId($this->company->id)->first();
// $ct = CompanyToken::whereUserId($user->id)->whereCompanyId($this->company->id)->first(); $ct = CompanyToken::whereUserId($user->id)->whereCompanyId($this->company->id)->first();
// $this->assertNull($cu); $this->assertNull($cu);
// $this->assertNull($ct); $this->assertNull($ct);
// $this->assertNotNull($user); $this->assertNotNull($user);
// } }
public function testAttachUserToMultipleCompanies() public function testAttachUserToMultipleCompanies()
{ {