~lderan/ubuntu-autopilot-tests/xubuntu-autopilot-tests

« back to all changes in this revision

Viewing changes to ubuntu_autopilot_tests/terminal/test_terminal.py

  • Committer: Dan Chapman
  • Date: 2013-11-25 09:57:41 UTC
  • mfrom: (59.2.10 ubuntu-autopilot-tests)
  • Revision ID: daniel@chapman-mail.com-20131125095741-0x7d1rkle34khjrp
Merge Jackson's pep8 fixes from lp:~noskcaj/ubuntu-autopilot-tests/pep8

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import shutil
20
20
import tempfile
21
21
from autopilot.matchers import Eventually
22
 
from testtools.matchers import Equals, Contains, FileExists, DirExists, DirContains
 
22
from testtools.matchers import Equals, Contains, FileExists, DirExists, \
 
23
    DirContains
23
24
from terminal import TerminalAutopilotTestCase
24
25
 
25
26
 
27
28
 
28
29
    def test_save_a_file(self):
29
30
        self.keyboard.type("touch /tmp/test-file\n")
30
 
        #Verify that test-file has been created
 
31
        # Verify that test-file has been created
31
32
        self.assertTrue('/tmp/testfile', FileExists())
32
 
        #Delete the file we created
 
33
        # Delete the file we created
33
34
        self.addCleanup(os.remove, "/tmp/test-file")
34
35
 
35
36
    def test_create_directory(self):
44
45
 
45
46
    def test_move_directory_with_files(self):
46
47
        self.create_temp_directory_with_temp_files()
47
 
        #create directory to move to
 
48
        # create directory to move to
48
49
        self.keyboard.type('mkdir /tmp/temp-dir2\n')
49
 
        #move temp-dir to temp-dir2
 
50
        # move temp-dir to temp-dir2
50
51
        self.keyboard.type('mv /tmp/temp-dir/ /tmp/temp-dir2/\n')
51
 
        #assert dir moved
 
52
        # assert dir moved
52
53
        self.assertTrue('/tmp/temp-dir2/temp-dir/', DirExists())
53
 
        ##assert files moved
54
 
        self.assertTrue('/tmp/temp-dir2/temp-dir/', DirContains(['a', 'b', 'c']))
 
54
        # assert files moved
 
55
        self.assertTrue(
 
56
            '/tmp/temp-dir2/temp-dir/', DirContains(['a', 'b', 'c']))
55
57
 
56
58
        self.addCleanup(shutil.rmtree, '/tmp/temp-dir2')
57
59
 
58
60
    def test_copying_file(self):
59
61
        self.create_temp_directory_with_temp_files()
60
 
        #create directory to move to
 
62
        # create directory to move to
61
63
        self.keyboard.type('mkdir /tmp/temp-dir2\n')
62
 
        #move file 'a' to temp-dir2
 
64
        # move file 'a' to temp-dir2
63
65
        self.keyboard.type('cp /tmp/temp-dir/a /tmp/temp-dir2/\n')
64
 
        ##assert file moved
 
66
        # assert file moved
65
67
        self.assertTrue('/tmp/temp-dir2/temp-dir/', DirContains(['a']))
66
68
        self.addCleanup(shutil.rmtree, '/tmp/temp-dir')
67
69
        self.addCleanup(shutil.rmtree, '/tmp/temp-dir2')
81
83
        terminal_window = self.app.select_single('TerminalWindow')
82
84
        self.keyboard.type('cd\n')
83
85
        self.keyboard.type('cd Documents\n')
84
 
        self.assertThat(terminal_window.title, Eventually(Contains('~/Documents')))
 
86
        self.assertThat(
 
87
            terminal_window.title, Eventually(Contains('~/Documents')))
85
88
 
86
89
    def test_open_new_tab(self, ):
87
 
        #open a new tab
 
90
        # open a new tab
88
91
        self.keyboard.press_and_release('Ctrl+Shift+t')
89
92
        # test number of tabs(containers) equals 2
90
93
        tabs = self.app.select_many('TerminalScreenContainer')
91
94
        self.assertThat(len(tabs), Equals(2))
92