Skip to content

Commit

Permalink
Use user.present/absent states to manage user in virtualenv test
Browse files Browse the repository at this point in the history
  • Loading branch information
terminalmage committed Mar 15, 2017
1 parent 5f99b04 commit 5b71db2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions tests/integration/states/test_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ class VirtualenvTest(integration.ModuleCase,
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
def test_issue_1959_virtualenv_runas(self):
user = 'issue-1959'
if not self.run_function('user.add', [user]):
# Left behind on a canceled test run?
self.run_function('user.delete', [user, True, True])
if not self.run_function('user.add', [user]):
self.skipTest('Failed to create the \'{0}\' user'.format(user))
self.assertSaltTrueReturn(self.run_state('user.present', name=user))

uinfo = self.run_function('user.info', [user])

Expand All @@ -53,7 +49,7 @@ def test_issue_1959_virtualenv_runas(self):
finally:
if os.path.isdir(venv_dir):
shutil.rmtree(venv_dir)
self.run_function('user.delete', [user, True, True])
self.assertSaltTrueReturn(self.run_state('user.absent', name=user))

def test_issue_2594_non_invalidated_cache(self):
# Testing virtualenv directory
Expand Down

0 comments on commit 5b71db2

Please sign in to comment.