def setUp(self):
     """
     @summary: set up
     @return: None
     """
     super(TestSendGmailMail, self).setUp()
     cfg_file = 'tests.tablet.google_fast.conf'
     self.mail = MailImpl()
     self.mailCfg = self.config.read(cfg_file, 'gmail_mail')
class TestSendGmailMail(UIATestBase):
    """
    @summary: Test send gmail email function
    """
    def setUp(self):
        """
        @summary: set up
        @return: None
        """
        super(TestSendGmailMail, self).setUp()
        cfg_file = 'tests.tablet.google_fast.conf'
        self.mail = MailImpl()
        self.mailCfg = self.config.read(cfg_file, 'gmail_mail')

    def tearDown(self):
        """
        @summary: tear tearDown
        @return: None
        """
        super(TestSendGmailMail, self).tearDown()
        self.contacts = None

    def testSendGmailMail(self):
        """
        This test used to test contacts app

        The test case spec is following:
        1. launch mail app
        2. send Gmail Mail
        """
        sender_account = self.mailCfg.get("sender_account")
        receiver_account = self.mailCfg.get("receiver_account")
        subject = self.mailCfg.get("subject")
        body = self.mailCfg.get("body")
        attachment_file_name = self.mailCfg.get("attachment")

        self.mail.launch_by_am()
        self.mail.select_account(sender_account)
        self.mail.compose_a_new_email(receiver_account, subject, body)
        #attachment_file_name = "aaa.png"
        #base_path = os.path.split(os.path.realpath(__file__))[0]
        base_path = "/sdcard/Download/"
        self.mail.screenshot_and_attach(base_path, attachment_file_name)
        self.mail.send_email()
        self.mail.delete_screenshot_file(base_path, attachment_file_name)