From c9e317872004cdd7e58a9474d17a1b85888c5873 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 3 Oct 2015 18:22:06 -0400 Subject: Fix issue when unlinking Gitlab account --- tests/units/Model/UserTest.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests/units/Model/UserTest.php') diff --git a/tests/units/Model/UserTest.php b/tests/units/Model/UserTest.php index ac16a300..85631cd6 100644 --- a/tests/units/Model/UserTest.php +++ b/tests/units/Model/UserTest.php @@ -250,7 +250,7 @@ class UserTest extends Base ); $u->prepare($input); - $this->assertEquals(array(), $input); + $this->assertEquals(array('gitlab_id' => null), $input); $input = array( 'gitlab_id' => 'something', @@ -325,8 +325,11 @@ class UserTest extends Base public function testUpdate() { $u = new User($this->container); - $this->assertNotFalse($u->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto'))); + $this->assertEquals(2, $u->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto'))); + $this->assertEquals(3, $u->create(array('username' => 'plop', 'gitlab_id' => '123'))); + $this->assertTrue($u->update(array('id' => 2, 'username' => 'biloute'))); + $this->assertTrue($u->update(array('id' => 3, 'gitlab_id' => ''))); $user = $u->getById(2); $this->assertNotFalse($user); @@ -335,6 +338,10 @@ class UserTest extends Base $this->assertEquals('Toto', $user['name']); $this->assertEquals(0, $user['is_admin']); $this->assertEquals(0, $user['is_ldap_user']); + + $user = $u->getById(3); + $this->assertNotEmpty($user); + $this->assertEquals(null, $user['gitlab_id']); } public function testRemove() -- cgit v1.2.3