~nataliabidart/magicicada-client/fix-travis-ubuntuone-clientdefs

« back to all changes in this revision

Viewing changes to magicicadaclient/syncdaemon/tests/test_utils.py

  • Committer: Natalia
  • Date: 2018-05-19 20:44:54 UTC
  • mto: This revision was merged to the branch mainline in revision 1445.
  • Revision ID: natalia.bidart@ubuntu.com-20180519204454-fliiqyexj67r7fp9
- Rename python package to magicicadaclient.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
from twisted.trial.unittest import TestCase
34
34
 
35
 
import ubuntuone.syncdaemon.utils
 
35
from magicicadaclient.syncdaemon import utils
36
36
 
37
37
 
38
38
class UtilsTestCase(TestCase):
41
41
    def test_get_sd_bin_cmd_src_nonlinux(self):
42
42
        """Test that we use the buildout python running from source."""
43
43
        self.patch(sys, 'platform', 'darwin')
44
 
        self.patch(ubuntuone.syncdaemon.utils, 'get_program_path',
45
 
                   lambda _, *args, **kwargs: 'test-path')
46
 
        args = ubuntuone.syncdaemon.utils.get_sd_bin_cmd()
 
44
        self.patch(
 
45
            utils, 'get_program_path', lambda _, *args, **kwargs: 'test-path')
 
46
        args = utils.get_sd_bin_cmd()
47
47
        self.assertEqual(len(args), 2)
48
48
        self.assertEqual(args[0], 'python')
49
49
 
50
50
    def test_get_sd_bin_cmd_src_linux(self):
51
51
        """Test that we DO NOT use the buildout python running from source."""
52
52
        self.patch(sys, 'platform', 'linux2')
53
 
        self.patch(ubuntuone.syncdaemon.utils, 'get_program_path',
54
 
                   lambda _, *args, **kwargs: 'test-path')
55
 
        args = ubuntuone.syncdaemon.utils.get_sd_bin_cmd()
 
53
        self.patch(
 
54
            utils, 'get_program_path', lambda _, *args, **kwargs: 'test-path')
 
55
        args = utils.get_sd_bin_cmd()
56
56
        self.assertEqual(len(args), 1)
57
57
        self.assertEqual(args[0], 'test-path')
58
58
 
61
61
        sys.frozen = True
62
62
        self.addCleanup(delattr, sys, 'frozen')
63
63
        self.patch(sys, 'platform', 'darwin')
64
 
        self.patch(ubuntuone.syncdaemon.utils, 'get_program_path',
65
 
                   lambda _, *args, **kwargs: 'test-path')
66
 
        args = ubuntuone.syncdaemon.utils.get_sd_bin_cmd()
 
64
        self.patch(
 
65
            utils, 'get_program_path', lambda _, *args, **kwargs: 'test-path')
 
66
        args = utils.get_sd_bin_cmd()
67
67
        self.assertEqual(len(args), 1)
68
68
        self.assertEqual(args[0], 'test-path')
69
69
 
72
72
        sys.frozen = True
73
73
        self.addCleanup(delattr, sys, 'frozen')
74
74
        self.patch(sys, 'platform', 'linux2')
75
 
        self.patch(ubuntuone.syncdaemon.utils, 'get_program_path',
76
 
                   lambda _, *args, **kwargs: 'test-path')
77
 
        args = ubuntuone.syncdaemon.utils.get_sd_bin_cmd()
 
75
        self.patch(
 
76
            utils, 'get_program_path', lambda _, *args, **kwargs: 'test-path')
 
77
        args = utils.get_sd_bin_cmd()
78
78
        self.assertEqual(len(args), 1)
79
79
        self.assertEqual(args[0], 'test-path')