def testRoot(self): mock_client = _MockClient() with mock.patch.object(magics_impl._state, 'client', mock_client): cur_dir = magics_impl.grr_pwd_impl() self.assertEqual(cur_dir, '/')
def testNonRootPath(self): mock_client = _MockClient() with mock.patch.object(magics_impl._state, 'client', mock_client): with mock.patch.object(magics_impl._state, 'cur_dir', '/foo/bar'): cur_dir = magics_impl.grr_pwd_impl() self.assertEqual(cur_dir, '/foo/bar')
def grr_pwd(line: Text) -> Text: """Returns absolute path to the current directory. Args: line: A string representing arguments passed to the magic command. Returns: Absolute path to the current directory. Raises: NoClientSelectedError: Client is not selected to perform this operation. """ del line # Unused. return magics_impl.grr_pwd_impl()
def testNoClientSelected(self): with self.assertRaises(magics_impl.NoClientSelectedError): magics_impl.grr_pwd_impl()