Coverage for pass_import/managers/figaropm.py: 100%

22 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-02-26 12:11 +0000

1# -*- encoding: utf-8 -*- 

2# pass import - Passwords importer swiss army knife 

3# Copyright (C) 2017-2024 Alexandre PUJOL <alexandre@pujol.io>. 

4# 

5 

6from pass_import.core import register_managers 

7from pass_import.formats.xml import XML 

8 

9 

10class FigaroPM(XML): 

11 """Importer for Figaro Password Manager in XML format.""" 

12 name = 'fpm' 

13 url = 'http://fpm.sourceforge.net' 

14 hexport = 'File > Export Passwords: Plain XML' 

15 himport = 'pass import fpm file.xml' 

16 xml_header = {'root': 'FPM'} 

17 keys = { 

18 'title': 'title', 

19 'password': 'password', 

20 'login': 'user', 

21 'url': 'url', 

22 'comments': 'notes', 

23 'group': 'category' 

24 } 

25 

26 @classmethod 

27 def _getroot(cls, tree): 

28 return tree.find('PasswordList') 

29 

30 def _import(self, element, path=''): 

31 for xmlentry in element.findall('PasswordItem'): 

32 entry = self._getentry(xmlentry) 

33 self.data.append(entry) 

34 

35 

36class Kedpm(FigaroPM): 

37 """Importer for Ked Password Manager in XML format.""" 

38 name = 'kedpm' 

39 url = 'http://fpm.sourceforge.net' 

40 hexport = 'File > Export Passwords: Plain XML' 

41 himport = 'pass import kedpm file.xml' 

42 

43 

44register_managers(FigaroPM, Kedpm)