# Path: memacs/phonecalls.py
# class PhonecallsMemacs(Memacs):
#     def _parser_add_arguments(self):
#         """
#         overwritten method of class Memacs
# 
#         add additional arguments
#         """
#         Memacs._parser_add_arguments(self)
# 
#         self._parser.add_argument(
#             "-f", "--file", dest="smsxmlfile",
#             action="store", required=True,
#             help="path to sms xml backup file")
# 
#         self._parser.add_argument(
#             "--ignore-incoming", dest="ignore_incoming",
#             action="store_true",
#             help="ignore incoming phonecalls")
# 
#         self._parser.add_argument(
#             "--ignore-outgoing", dest="ignore_outgoing",
#             action="store_true",
#             help="ignore outgoing phonecalls")
# 
#         self._parser.add_argument(
#             "--ignore-missed", dest="ignore_missed",
#             action="store_true",
#             help="ignore outgoing phonecalls")
# 
#         self._parser.add_argument(
#             "--ignore-cancelled", dest="ignore_cancelled",
#             action="store_true",
#             help="ignore cancelled phonecalls")
# 
#         self._parser.add_argument(
#             "--minimum-duration", dest="minimum_duration",
#             action="store", type=int,
#             help="[sec] show only calls with duration >= this argument")
# 
# 
#     def _parser_parse_args(self):
#         """
#         overwritten method of class Memacs
# 
#         all additional arguments are parsed in here
#         """
#         Memacs._parser_parse_args(self)
#         if not (os.path.exists(self._args.smsxmlfile) or \
#                      os.access(self._args.smsxmlfile, os.R_OK)):
#             self._parser.error("input file not found or not readable")
# 
# 
#     def _main(self):
#         """
#         gets called automatically from Memacs class.
#         read the lines from phonecalls backup xml file,
#         parse and write them to org file
#         """
# 
#         data = CommonReader.get_data_from_file(self._args.smsxmlfile)
# 
#         try:
#             xml.sax.parseString(data.encode('utf-8'),
#                                 PhonecallsSaxHandler(self._writer,
#                                               self._args.ignore_incoming,
#                                               self._args.ignore_outgoing,
#                                               self._args.ignore_missed,
#                                               self._args.ignore_cancelled,
#                                               self._args.minimum_duration or 0,
#                                               ))
#         except SAXParseException:
#             logging.error("No correct XML given")
#             sys.exit(1)


import os
import re
import time
import unittest
import xml.etree.ElementTree as ET
from memacs.phonecalls import PhonecallsMemacs
# -*- coding: utf-8 -*-
# Time-stamp: <2012-09-06 22:02:48 armin>




class TestPhonecallsMemacs(unittest.TestCase):

    def setUp(self):
        self._test_file = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), 'data', 'calls.xml'
        )
        argv = "-s -f " + self._test_file

# Path: memacs/phonecalls.py
# class PhonecallsMemacs(Memacs):
#     def _parser_add_arguments(self):
#         """
#         overwritten method of class Memacs
# 
#         add additional arguments
#         """
#         Memacs._parser_add_arguments(self)
# 
#         self._parser.add_argument(
#             "-f", "--file", dest="smsxmlfile",
#             action="store", required=True,
#             help="path to sms xml backup file")
# 
#         self._parser.add_argument(
#             "--ignore-incoming", dest="ignore_incoming",
#             action="store_true",
#             help="ignore incoming phonecalls")
# 
#         self._parser.add_argument(
#             "--ignore-outgoing", dest="ignore_outgoing",
#             action="store_true",
#             help="ignore outgoing phonecalls")
# 
#         self._parser.add_argument(
#             "--ignore-missed", dest="ignore_missed",
#             action="store_true",
#             help="ignore outgoing phonecalls")
# 
#         self._parser.add_argument(
#             "--ignore-cancelled", dest="ignore_cancelled",
#             action="store_true",
#             help="ignore cancelled phonecalls")
# 
#         self._parser.add_argument(
#             "--minimum-duration", dest="minimum_duration",
#             action="store", type=int,
#             help="[sec] show only calls with duration >= this argument")
# 
# 
#     def _parser_parse_args(self):
#         """
#         overwritten method of class Memacs
# 
#         all additional arguments are parsed in here
#         """
#         Memacs._parser_parse_args(self)
#         if not (os.path.exists(self._args.smsxmlfile) or \
#                      os.access(self._args.smsxmlfile, os.R_OK)):
#             self._parser.error("input file not found or not readable")
# 
# 
#     def _main(self):
#         """
#         gets called automatically from Memacs class.
#         read the lines from phonecalls backup xml file,
#         parse and write them to org file
#         """
# 
#         data = CommonReader.get_data_from_file(self._args.smsxmlfile)
# 
#         try:
#             xml.sax.parseString(data.encode('utf-8'),
#                                 PhonecallsSaxHandler(self._writer,
#                                               self._args.ignore_incoming,
#                                               self._args.ignore_outgoing,
#                                               self._args.ignore_missed,
#                                               self._args.ignore_cancelled,
#                                               self._args.minimum_duration or 0,
#                                               ))
#         except SAXParseException:
#             logging.error("No correct XML given")
#             sys.exit(1)


# Path: memacs/tests/phonecalls_test.py
import os
import re
import time
import unittest
import xml.etree.ElementTree as ET
from memacs.phonecalls import PhonecallsMemacs

# -*- coding: utf-8 -*-
# Time-stamp: <2012-09-06 22:02:48 armin>




class TestPhonecallsMemacs(unittest.TestCase):

    def setUp(self):
        self._test_file = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), 'data', 'calls.xml'
        )
        argv = "-s -f " + self._test_file

        memacs = PhonecallsMemacs(argv=argv.split())