~lutostag/ubuntu/trusty/maas/1.5.2+packagefix

« back to all changes in this revision

Viewing changes to src/provisioningserver/tests/test_omshell.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2014-03-28 10:43:53 UTC
  • mto: This revision was merged to the branch mainline in revision 57.
  • Revision ID: package-import@ubuntu.com-20140328104353-ekpolg0pm5xnvq2s
Tags: upstream-1.5+bzr2204
ImportĀ upstreamĀ versionĀ 1.5+bzr2204

Show diffs side-by-side

added added

removed removed

Lines of Context:
184
184
            subprocess.CalledProcessError, shell.remove, ip_address)
185
185
        self.assertEqual(random_output, exc.output)
186
186
 
 
187
    def test_remove_works_when_extraneous_blank_last_lines(self):
 
188
        # Sometimes omshell puts blank lines after the 'obj: <null>' so
 
189
        # we need to test that the code still works if that's the case.
 
190
        server_address = factory.getRandomString()
 
191
        shared_key = factory.getRandomString()
 
192
        ip_address = factory.getRandomIPAddress()
 
193
        shell = Omshell(server_address, shared_key)
 
194
 
 
195
        # Fake a call that results in a something with our special output.
 
196
        output = "\nobj: <null>\n\n"
 
197
        self.patch(shell, '_run').return_value = (0, output)
 
198
        self.assertIsNone(shell.remove(ip_address))
 
199
 
187
200
 
188
201
class Test_generate_omapi_key(MAASTestCase):
189
202
    """Tests for omshell.generate_omapi_key"""