summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-07-30 12:50:57 +0000
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-08-11 17:00:30 +0200
commit64b2e37cfc15eff18da473fa20f076c22a5f904b (patch)
tree7ae50cba11ae5d45d678ed37168e76e7ee9ee5d4 /service
parente9416f5ebdced75f9463073a25d2b999969124a4 (diff)
Removed relative import of test resources.
- test_contacts.py and test_commands.py
Diffstat (limited to 'service')
-rw-r--r--service/test/integration/test_contacts.py4
-rw-r--r--service/test/unit/maintenance/test_commands.py3
2 files changed, 4 insertions, 3 deletions
diff --git a/service/test/integration/test_contacts.py b/service/test/integration/test_contacts.py
index a838e15b..d2e2ac2a 100644
--- a/service/test/integration/test_contacts.py
+++ b/service/test/integration/test_contacts.py
@@ -15,8 +15,8 @@
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
from test.support.integration import SoledadTestBase, MailBuilder
from twisted.internet import defer
-import os
import json
+import pkg_resources
class ContactsTest(SoledadTestBase):
@@ -97,7 +97,7 @@ class ContactsTest(SoledadTestBase):
self.assertIn('this_mail_was_not@bounced.com', contacts)
def _bounced_mail_hdoc_content(self):
- hdoc_file = os.path.join(os.path.dirname(__file__), '..', 'unit', 'fixtures', 'bounced_mail_hdoc.json')
+ hdoc_file = pkg_resources.resource_filename('test.unit.fixtures', 'bounced_mail_hdoc.json')
with open(hdoc_file) as f:
hdoc = json.loads(f.read())
return hdoc
diff --git a/service/test/unit/maintenance/test_commands.py b/service/test/unit/maintenance/test_commands.py
index 4eb2e990..6e097cea 100644
--- a/service/test/unit/maintenance/test_commands.py
+++ b/service/test/unit/maintenance/test_commands.py
@@ -25,6 +25,7 @@ from leap.soledad.common.document import SoledadDocument
from mock import MagicMock
from os.path import join, dirname
from twisted.internet import defer, reactor
+import pkg_resources
class TestCommands(unittest.TestCase):
@@ -80,7 +81,7 @@ class TestCommands(unittest.TestCase):
def test_load_mails_adds_mails(self):
# given
- mail_root = join(dirname(__file__), '..', 'fixtures', 'mailset')
+ mail_root = pkg_resources.resource_filename('test.unit.fixtures', 'mailset')
firstMailDeferred = defer.Deferred()
secondMailDeferred = defer.Deferred()
self.mailbox.addMessage.side_effect = [firstMailDeferred, secondMailDeferred]