Example #1
0
 def XXXtestOneSetOfCalls(self):
     root_path = sut_lib.checkDeviceRoot()
     source_file = 'testing'
     source_path = os.path.join('/path/to', source_file)
     installed_path = os.path.join(root_path, source_file)
     installApp.main(['app', 1, source_path])
     the_mock.pushFile.assert_called_once_with(source_path, installed_path)
     the_mock.installApp.assert_called_once_with(installed_path)
Example #2
0
 def XXXtestOneSetOfCalls(self):
     root_path = sut_lib.checkDeviceRoot.return_value
     source_file = 'testing'
     source_path = os.path.join('/path/to', source_file)
     installed_path = os.path.join(root_path, source_file)
     installApp.main(['app', 1, source_path])
     the_mock.pushFile.assert_called_once_with(source_path, installed_path) 
     the_mock.installApp.assert_called_once_with(installed_path)
Example #3
0
 def testSourceFileName(self):
     root_path = sut_lib.checkDeviceRoot.return_value
     for source_file in ['test_1', 'test_2']:
         src_path = os.path.join('/path/to', source_file)
         installed_path = os.path.join(root_path, source_file)
         expected_args = ((installed_path,), {})
         installApp.main(['app',1,src_path])
         self.assertTrue(expected_args in the_mock.installApp.call_args_list)
Example #4
0
 def testSourceFileName(self):
     root_path = sut_lib.checkDeviceRoot()
     for source_file in ['test_1', 'test_2']:
         src_path = os.path.join('/path/to', source_file)
         installed_path = os.path.join(root_path, source_file)
         expected_args = ((installed_path, ), {})
         installApp.main(['app', 1, src_path])
         self.assertTrue(
             expected_args in the_mock.installApp.call_args_list)
Example #5
0
 def test_error_short_args(self):
     # we expect the script to exit via sys.exit(1)
     try:
         # since a "normal" or "clean" script exits via sys.exit(0),
         # we need to catch the exception, and inspect the return
         # code (i.e.  we can't use the normal "assertRaises"
         # approach)
         installApp.main(['app', 1])
     except SystemExit as e:
         self.assertEqual(1, e.code)
     else:
         self.fail('should have exited via sys.exit(1)')
Example #6
0
 def test_error_short_args(self):
     # we expect the script to exit via sys.exit(1)
     try:
         # since a "normal" or "clean" script exits via sys.exit(0),
         # we need to catch the exception, and inspect the return
         # code (i.e.  we can't use the normal "assertRaises"
         # approach)
         installApp.main(['app',1])
     except SystemExit as e:
         self.assertEqual(1, e.code)
     else:
         self.fail('should have exited via sys.exit(1)')
Example #7
0
    def test_robocop_not_found(self):
        root_path = sut_lib.checkDeviceRoot()
        source_file = 'fennec.eggs.arm.apk'
        source_path = os.path.join('build/', source_file)
        installed_path = os.path.join(root_path, source_file)
        expected_pushFile_calls = [((source_path, installed_path), {}), ]
        expected_installApp_calls = [((installed_path,), {}), ]

        # simulate not finding robocop.apk - should not attempt install
        # then
        os.path.exists.return_value = False
        installApp.main(['app', 1, source_path])

        self.assertEqual(the_mock.installApp.call_args_list,
                         expected_installApp_calls)
        self.assertEqual(the_mock.pushFile.call_args_list,
                         expected_pushFile_calls)
Example #8
0
    def test_robocop_found(self):
        root_path = sut_lib.checkDeviceRoot.return_value
        source_file = 'fennec.eggs.arm.apk'
        robocop_file = 'robocop.apk'
        source_path = os.path.join('build/', source_file)
        robocop_source_path = os.path.join('build/tests/bin', robocop_file)
        installed_path = os.path.join(root_path, source_file)
        robocop_installed_path = os.path.join(root_path, robocop_file)
        expected_pushFile_calls = [((source_path, installed_path), {}),
                                   ((robocop_source_path, robocop_installed_path), {})]
        expected_installApp_calls = [((installed_path,), {}),
                                     ((robocop_installed_path,), {})]

        installApp.main(['app', 1, source_path])

        self.assertEqual(the_mock.installApp.call_args_list,
                         expected_installApp_calls)
        self.assertEqual(the_mock.pushFile.call_args_list,
                         expected_pushFile_calls)
Example #9
0
    def test_robocop_found(self):
        root_path = sut_lib.checkDeviceRoot()
        source_file = 'fennec.eggs.arm.apk'
        robocop_file = 'robocop.apk'
        source_path = os.path.join('build/', source_file)
        robocop_source_path = os.path.join('build/tests/bin', robocop_file)
        installed_path = os.path.join(root_path, source_file)
        robocop_installed_path = os.path.join(root_path, robocop_file)
        expected_pushFile_calls = [((source_path, installed_path), {}),
                                   ((robocop_source_path,
                                     robocop_installed_path), {})]
        expected_installApp_calls = [((installed_path, ), {}),
                                     ((robocop_installed_path, ), {})]

        installApp.main(['app', 1, source_path])

        self.assertEqual(the_mock.installApp.call_args_list,
                         expected_installApp_calls)
        self.assertEqual(the_mock.pushFile.call_args_list,
                         expected_pushFile_calls)
Example #10
0
    def test_robocop_not_found(self):
        root_path = sut_lib.checkDeviceRoot()
        source_file = 'fennec.eggs.arm.apk'
        source_path = os.path.join('build/', source_file)
        installed_path = os.path.join(root_path, source_file)
        expected_pushFile_calls = [
            ((source_path, installed_path), {}),
        ]
        expected_installApp_calls = [
            ((installed_path, ), {}),
        ]

        # simulate not finding robocop.apk - should not attempt install
        # then
        os.path.exists.return_value = False
        installApp.main(['app', 1, source_path])

        self.assertEqual(the_mock.installApp.call_args_list,
                         expected_installApp_calls)
        self.assertEqual(the_mock.pushFile.call_args_list,
                         expected_pushFile_calls)
Example #11
0
 def test_three_args_okay(self):
     installApp.main(['app', 1, '/path/to/source_file', 3])
Example #12
0
 def testIPAddress(self):
     for ip in ('hostname', '255.255.255.255'):
         installApp.main(['app', ip, 'path/to/something'])
         devicemanagerSUT.DeviceManagerSUT.assert_called_with(ip)
Example #13
0
 def testIPAddress(self):
     for ip in ('hostname', '255.255.255.255'):
         installApp.main(['app', ip, 'path/to/something'])
         devicemanagerSUT.DeviceManagerSUT.assert_called_with(ip)
Example #14
0
 def test_three_args_okay(self):
     installApp.main(['app',1,'/path/to/source_file',3])