def test_push_fail(self): ''' Test push fail. ''' str_ret = 'failed to copy \'foo\' to \'bar\': No such file or directory' with self.assertRaises(Exception) as cm: self.mock_obj.returncode = 1 self.mock_obj.communicate.return_value = [str_ret, None] self.mock_popen.return_value = self.mock_obj ret = AdbWrapper.adb_push('foo', 'bar')
def test_push_fail(self): """ Test push fail. """ str_ret = 'failed to copy \'foo\' to \'bar\': No such file or directory' with self.assertRaises(Exception) as cm: self.mock_obj.returncode = 1 self.mock_obj.communicate.return_value = [str_ret, None] self.mock_popen.return_value = self.mock_obj ret = AdbWrapper.adb_push('foo', 'bar')
def test_push(self): ''' Test push. ''' str_ret = '2 KB/s (104 bytes in 0.040s)' expected_ret = '2 KB/s (104 bytes in 0.040s)' self.mock_obj.communicate.return_value = [str_ret, None] self.mock_popen.return_value = self.mock_obj ret = AdbWrapper.adb_push('mozilla.test', '/b2g/mozilla.test') self.assertEqual(ret, expected_ret, 'The result should be {}, not {}.'.format(expected_ret, ret))
def test_push(self): """ Test push. """ str_ret = '2 KB/s (104 bytes in 0.040s)' expected_ret = '2 KB/s (104 bytes in 0.040s)' self.mock_obj.communicate.return_value = [str_ret, None] self.mock_popen.return_value = self.mock_obj ret = AdbWrapper.adb_push('mozilla.test', '/b2g/mozilla.test') self.assertEqual( ret, expected_ret, 'The result should be {}, not {}.'.format(expected_ret, ret))