=== modified file 'tests/autopilot/messaging_app/emulators.py'
--- tests/autopilot/messaging_app/emulators.py	2014-04-07 21:06:51 +0000
+++ tests/autopilot/messaging_app/emulators.py	2014-06-04 17:51:38 +0000
@@ -10,17 +10,14 @@
 
 """Messaging app autopilot emulators."""
 
-import dbus
 import logging
-import os
-import shutil
 import subprocess
-import tempfile
 import time
 
 from autopilot import logging as autopilot_logging
 from autopilot.input import Keyboard
 from autopilot.platform import model
+
 from ubuntuuitoolkit import emulators as toolkit_emulators
 
 
@@ -373,32 +370,6 @@
                 'direction can be right or left'.format(direction)
             )
 
-    def receive_sms(self, sender, text):
-        """Receive an SMS based on sender number and text
-
-        :parameter sender: phone number the message is from
-        :parameter text: text you want to send in the message
-        """
-
-        # prepare and send a Qt GUI script to phonesim, over its private D-BUS
-        # set up by ofono-phonesim-autostart
-        script_dir = tempfile.mkdtemp(prefix="phonesim_script")
-        os.chmod(script_dir, 0o755)
-        with open(os.path.join(script_dir, "sms.js"), "w") as f:
-            f.write("""tabSMS.gbMessage1.leMessageSender.text = "%s";
-tabSMS.gbMessage1.leSMSClass.text = "1";
-tabSMS.gbMessage1.teSMSText.setPlainText("%s");
-tabSMS.gbMessage1.pbSendSMSMessage.click();
-""" % (sender, text))
-
-        with open("/run/lock/ofono-phonesim-dbus.address") as f:
-            phonesim_bus = f.read().strip()
-        bus = dbus.bus.BusConnection(phonesim_bus)
-        script_proxy = bus.get_object("org.ofono.phonesim", "/")
-        script_proxy.SetPath(script_dir)
-        script_proxy.Run("sms.js")
-        shutil.rmtree(script_dir)
-
 
 class MainPage(toolkit_emulators.UbuntuUIToolkitEmulatorBase):
     """Autopilot helper for the Main Page."""

=== added file 'tests/autopilot/messaging_app/helpers.py'
--- tests/autopilot/messaging_app/helpers.py	1970-01-01 00:00:00 +0000
+++ tests/autopilot/messaging_app/helpers.py	2014-06-04 17:51:38 +0000
@@ -0,0 +1,40 @@
+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
+# Copyright 2014 Canonical
+#
+# This file is part of messaging-app.
+#
+# messaging-app is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
+# by the Free Software Foundation.
+
+import dbus
+import os
+import shutil
+import tempfile
+
+
+def receive_sms(sender, text):
+    """Receive an SMS based on sender number and text
+
+    :parameter sender: phone number the message is from
+    :parameter text: text you want to send in the message
+    """
+
+    # prepare and send a Qt GUI script to phonesim, over its private D-BUS
+    # set up by ofono-phonesim-autostart
+    script_dir = tempfile.mkdtemp(prefix="phonesim_script")
+    os.chmod(script_dir, 0o755)
+    with open(os.path.join(script_dir, "sms.js"), "w") as f:
+        f.write("""tabSMS.gbMessage1.leMessageSender.text = "%s";
+tabSMS.gbMessage1.leSMSClass.text = "1";
+tabSMS.gbMessage1.teSMSText.setPlainText("%s");
+tabSMS.gbMessage1.pbSendSMSMessage.click();
+""" % (sender, text))
+
+    with open("/run/lock/ofono-phonesim-dbus.address") as f:
+        phonesim_bus = f.read().strip()
+    bus = dbus.bus.BusConnection(phonesim_bus)
+    script_proxy = bus.get_object("org.ofono.phonesim", "/")
+    script_proxy.SetPath(script_dir)
+    script_proxy.Run("sms.js")
+    shutil.rmtree(script_dir)

=== modified file 'tests/autopilot/messaging_app/tests/test_messaging.py'
--- tests/autopilot/messaging_app/tests/test_messaging.py	2014-04-10 15:30:35 +0000
+++ tests/autopilot/messaging_app/tests/test_messaging.py	2014-06-04 17:51:38 +0000
@@ -20,6 +20,7 @@
 from testtools import skipIf, skip
 
 from messaging_app import emulators
+from messaging_app import helpers
 from messaging_app.tests import MessagingAppTestCase
 
 
@@ -108,7 +109,7 @@
     def test_receive_message(self):
         """Verify that we can receive a text message"""
         # receive an sms message
-        self.main_view.receive_sms('0815', 'hello to Ubuntu')
+        helpers.receive_sms('0815', 'hello to Ubuntu')
 
         # verify that we got the message
         self.assertThat(self.thread_list.count, Eventually(Equals(1)))
@@ -225,7 +226,7 @@
         number = '5555555678'
         message = 'open me'
         # receive message
-        self.main_view.receive_sms(number, message)
+        helpers.receive_sms(number, message)
         self.assertThat(self.thread_list.count, Eventually(Equals(1)))
         # click message thread
         mess_thread = self.thread_list.wait_select_single('Label', text=number)
@@ -303,12 +304,12 @@
         time.sleep(5)  # wait 5 seconds, the emulator is slow
         list_view.select_single("Label", text=message)
 
-    def test_recieve_text_with_letters_in_phone_number(self):
+    def test_receive_text_with_letters_in_phone_number(self):
         """verify we can receive a text message with letters for a phone #"""
         number = 'letters'
         message = 'open me'
         # receive message
-        self.main_view.receive_sms(number, message)
+        helpers.receive_sms(number, message)
         self.assertThat(self.thread_list.count, Eventually(Equals(1)))
         # click message thread
         mess_thread = self.thread_list.wait_select_single(
@@ -421,7 +422,7 @@
     def test_delete_message_thread_swipe_right(self):
         """Verify we can delete a message thread by swiping right"""
         # receive an sms message
-        self.main_view.receive_sms('0815', 'hello to Ubuntu')
+        helpers.receive_sms('0815', 'hello to Ubuntu')
 
         # verify that we got the message
         self.assertThat(self.thread_list.count, Eventually(Equals(1)))
@@ -457,7 +458,7 @@
     def test_delete_message_thread_swipe_left(self):
         """Verify we can delete a message thread by swiping left"""
         # receive an sms message
-        self.main_view.receive_sms('0815', 'hello to Ubuntu')
+        helpers.receive_sms('0815', 'hello to Ubuntu')
 
         # verify that we got the message
         self.assertThat(self.thread_list.count, Eventually(Equals(1)))
@@ -506,7 +507,7 @@
         message_indexes = list(reversed(range(3)))
         for index in message_indexes:
             message_text = 'test message {}'.format(index)
-            self.main_view.receive_sms(
+            helpers.receive_sms(
                 self.number, message_text)
             time.sleep(1)
             # Prepend to make sure that the indexes match.

