def test_autocomplete(self): """ :return: """ support.create_project(self, 'gina') support.add_step(self, 'a.py') support.add_step(self, 'b.py') result = support.autocomplete('steps a') self.assertIn('add', result) result = support.autocomplete('steps modify ') self.assertEqual( len(result), 2, 'there are two steps in {}'.format(result) ) result = support.autocomplete('steps modify a.py --') self.assertIn('name=', result) result = support.autocomplete('steps modify fake.py --position=') self.assertEqual( len(result), 2, 'there are two steps in {}'.format(result) ) support.run_command('close')
def test_autocomplete_flags(self): """ """ result = support.autocomplete('export --f') self.assertEqual(result, ['force']) result = support.autocomplete('export -') self.assertGreater(len(result), 2)
def test_autocomplete_flags(self): """ """ result = support.autocomplete('export --f') self.assertEqual(result, ['force']) result = support.autocomplete('export -') self.assertGreater(len(result), 2)
def test_autocomplete_flags(self): """ :return: """ result = support.autocomplete('open --r') self.assertEqual(result, ['recent']) result = support.autocomplete('open -') self.assertGreater(len(result), 3)
def test_autocomplete_flags(self): """ :return: """ result = support.autocomplete('open --r') self.assertEqual(result, ['recent']) result = support.autocomplete('open -') self.assertGreater(len(result), 3)
def test_autocomplete(self): """ :return: """ alias = 'ex' path = environ.paths.resources('examples') support.run_command( 'alias add "{}" "{}" --temporary'.format(alias, path) ) result = support.autocomplete('create my_project @home:') self.assertIsNotNone( result, support.Message( 'autocomplete result should not be None', result=result ) ) # Get all directories in the examples folder items = [(e, os.path.join(path, e)) for e in os.listdir(path)] items = [e for e in items if os.path.isdir(e[1])] result = support.autocomplete('create my_project @ex:') self.assertEqual( len(result), len(items), support.Message( 'should autocomplete from the examples folder', result=result, items=items ) ) hellos = [e for e in items if e[0].startswith('hell')] result = support.autocomplete('create my_project @ex:hell') self.assertEqual( len(result), len(hellos), support.Message( 'should autocomplete examples that start with "hell"', result=result, items=items ) )
def test_autocomplete_aliases(self): """ :return: """ result = support.autocomplete('open @fake:') self.assertEqual(len(result), 0) # Get all directories in the examples folder path = environ.paths.resources('examples') items = [(e, os.path.join(path, e)) for e in os.listdir(path)] items = [e for e in items if os.path.isdir(e[1])] result = support.autocomplete('open @examples:') self.assertEqual(len(result), len(items)) result = support.autocomplete('open @ex') self.assertIn('examples:', result)
def test_autocomplete_aliases(self): """ :return: """ result = support.autocomplete('open @fake:') self.assertEqual(len(result), 0) # Get all directories in the examples folder path = environ.paths.resources('examples') items = [(e, os.path.join(path, e)) for e in os.listdir(path)] items = [e for e in items if os.path.isdir(e[1])] result = support.autocomplete('open @examples:') self.assertEqual(len(result), len(items)) result = support.autocomplete('open @ex') self.assertIn('examples:', result)
def test_autocomplete(self): """ :return: """ support.create_project(self, 'gina') result = support.autocomplete('snapshot a') self.assertIn('add', result) support.run_command('snapshot add TEST --no-show') result = support.autocomplete('snapshot remove ') self.assertEqual( len(result), 1, 'TEST should be here {}'.format(result) ) support.run_command('close')
def test_autocomplete(self): """ should autocomplete step name """ support.create_project(self, 'crystal') support.add_step(self) step = cauldron.project.get_internal_project().steps[0] result = support.autocomplete('run {}'.format(step.filename[:2])) self.assertEqual(len(result), 1) self.assertEqual(result[0], step.filename)
def test_autocomplete(self): """ should autocomplete step name """ support.create_project(self, 'crystal') support.add_step(self) step = cauldron.project.get_internal_project().steps[0] result = support.autocomplete('run {}'.format(step.filename[:2])) self.assertEqual(len(result), 1) self.assertEqual(result[0], step.filename)
def test_autocomplete(self): """Should autocomplete steps command""" support.create_project(self, 'gina') support.add_step(self, 'a.py') support.add_step(self, 'b.py') result = support.autocomplete('steps a') self.assertIn('add', result) result = support.autocomplete('steps modify ') self.assertEqual( len(result), 2, 'there are two steps in {}'.format(result) ) result = support.autocomplete('steps modify a.py --') self.assertIn('name=', result) result = support.autocomplete('steps modify fake.py --position=') self.assertEqual( len(result), 2, 'there are two steps in {}'.format(result) )
def test_autocomplete(self): """ :return: """ alias = 'ex' path = environ.paths.resources('examples') support.run_command('alias add "{}" "{}" --temporary'.format( alias, path)) result = support.autocomplete('create my_project @home:') self.assertIsNotNone( result, support.Message('autocomplete result should not be None', result=result)) # Get all directories in the examples folder items = [(e, os.path.join(path, e)) for e in os.listdir(path)] items = [e for e in items if os.path.isdir(e[1])] result = support.autocomplete('create my_project @ex:') self.assertEqual( len(result), len(items), support.Message('should autocomplete from the examples folder', result=result, items=items)) hellos = [e for e in items if e[0].startswith('hell')] result = support.autocomplete('create my_project @ex:hell') self.assertEqual( len(result), len(hellos), support.Message( 'should autocomplete examples that start with "hell"', result=result, items=items))
def test_incomplete_alias(self): """ should properly autocomplete an incomplete alias """ result = support.autocomplete('create fake @ho') self.assertEqual(len(result), 1) self.assertEqual(result[0], 'home:')
def test_autocomplete_empty(self): """ should properly autocomplete an alias """ result = support.autocomplete('create') self.assertEqual(len(result), 0)
def test_autocomplete_absolute_path(self): """ should properly autocomplete an alias """ directory = os.path.dirname(os.path.realpath(__file__)) result = support.autocomplete('create fake "{}"'.format(directory)) self.assertIsNotNone(result)
def test_autocomplete(self): """ """ directory = os.path.dirname(os.path.realpath(__file__)) result = support.autocomplete('export {}'.format(directory)) self.assertIsNotNone(result)
def test_autocomplete_empty(self): """ """ directory = os.path.dirname(os.path.realpath(__file__)) result = support.autocomplete('export fake ') self.assertIsNotNone(result)
def test_autocomplete(self): """ should return empty options for autocomplete """ result = support.autocomplete('connect') self.assertEqual(len(result), 0)
def test_autocomplete_nothing(self): """ should return empty autocomplete when no option started """ result = support.autocomplete('run') self.assertEqual(len(result), 0)
def test_autocomplete_empty(self): """ should properly autocomplete an alias """ result = support.autocomplete('create') self.assertEqual(len(result), 0)
def test_autocomplete_path(self): """ """ path = os.path.dirname(os.path.realpath(__file__)) result = support.autocomplete('alias add test {}'.format(path)) self.assertIsNotNone(result)
def test_autocomplete_alias(self): """ """ result = support.autocomplete('alias add fake-alias-not-real') self.assertEqual(len(result), 0)
def test_autocomplete_command(self): """ """ result = support.autocomplete('alias ad') self.assertEqual(len(result), 1) self.assertEqual(result[0], 'add')
def test_autocomplete_nothing(self): """ should return empty autocomplete when no option started """ result = support.autocomplete('run') self.assertEqual(len(result), 0)
def test_autocomplete_long_flags(self): """ should return list of long flags """ result = support.autocomplete('run S01.py --') self.assertGreater(len(result), 2) self.assertIn('force', result)
def test_autocomplete_empty(self): """ """ directory = os.path.dirname(os.path.realpath(__file__)) result = support.autocomplete('export fake ') self.assertIsNotNone(result)
def test_autocomplete_long_flags(self): """ should return list of long flags """ result = support.autocomplete('run S01.py --') self.assertGreater(len(result), 2) self.assertIn('force', result)
def test_incomplete_alias(self): """ should properly autocomplete an incomplete alias """ result = support.autocomplete('create fake @ho') self.assertEqual(len(result), 1) self.assertEqual(result[0], 'home:')
def test_autocomplete_command(self): """ """ result = support.autocomplete('alias ad') self.assertEqual(len(result), 1) self.assertEqual(result[0], 'add')
def test_autocomplete(self): """ """ directory = os.path.dirname(os.path.realpath(__file__)) result = support.autocomplete('export {}'.format(directory)) self.assertIsNotNone(result)
def test_autocomplete(self): """ should return empty options for autocomplete """ result = support.autocomplete('connect') self.assertEqual(len(result), 0)
def test_autocomplete_alias(self): """ """ result = support.autocomplete('alias add fake-alias-not-real') self.assertEqual(len(result), 0)
def test_autocomplete_absolute_path(self): """ should properly autocomplete an alias """ directory = os.path.dirname(os.path.realpath(__file__)) result = support.autocomplete('create fake "{}"'.format(directory)) self.assertIsNotNone(result)
def test_autocomplete_path(self): """ """ path = os.path.dirname(os.path.realpath(__file__)) result = support.autocomplete('alias add test {}'.format(path)) self.assertIsNotNone(result)