예제 #1
0
 def test_06_edit(self):
     passtis.store_add(self.args, gnupghome=self.gpg_home)
     out = self.get_output()
     password = self.passwd_re.search(out).group(1)
     passtis.store_edit(self.args, gnupghome=self.gpg_home)
     out = self.get_output()
     password2 = self.passwd_re.search(out).group(1)
     self.assertNotEqual(
         password, password2,
         'password was not modified: {} == {}'.format(password, password2))
예제 #2
0
 def test_03_del(self):
     passtis.store_add(self.args, gnupghome=self.gpg_home)
     entry_path = os.path.join(self.args.dir, self.args.group,
                               self.args.name)
     self.assertTrue(
         os.path.exists(entry_path),
         'entry file was not added to the store: {}'.format(entry_path))
     passtis.store_del(self.args)
     self.assertFalse(
         os.path.exists(entry_path),
         'test entry file was not deleted from the store: {}'.format(
             entry_path))
예제 #3
0
 def test_02_add(self):
     for group in ['default'] + self.args.groups:
         self.args.group = group
         passtis.store_add(self.args, gnupghome=self.gpg_home)
         entry_path = os.path.join(self.args.dir, self.args.group,
                                   self.args.name)
         self.assertTrue(
             os.path.exists(entry_path),
             'entry file was not added to the store: {}'.format(entry_path))
         self.assertTrue(
             self.passwd_re.search(self.get_output()) is not None,
             'output didn\'t contain generated password')
예제 #4
0
 def test_05_list(self):
     for group in ['default'] + self.args.groups:
         self.args.group = group
         passtis.store_add(self.args, gnupghome=self.gpg_home)
     self.get_output()  # clean output buffer
     passtis.store_list(self.args)
     out = self.get_output()
     for group in self.args.groups:
         self.assertTrue(
             group in out,
             'inserted group was not present in output: {}'.format(group))
     self.assertFalse(
         'default' in out,
         'default group should not appear when filtering groups')
예제 #5
0
 def test_04_get(self):
     passtis.store_add(self.args, gnupghome=self.gpg_home)
     out = self.get_output()
     password = self.passwd_re.search(out).group(1)
     # with echo enabled
     passtis.store_get(self.args, gnupghome=self.gpg_home)
     out = self.get_output()
     password2 = self.passwd_re.search(out).group(1)
     self.assertEqual(
         password, password2,
         'returned password is not the expected one: {} != {}'.format(
             password, password2))
     # with echo disabled
     self.args.echo = False
     passtis.store_get(self.args, gnupghome=self.gpg_home)
     out = self.get_output()
     self.assertTrue(
         self.passwd_re.search(out) is None,
         'password was echoed-out while it shouldn\'t have')