Пример #1
0
 def test_config_command(self):
     # WARN: This modifies the existing key, which is restored by
     # tearDownClass().
     self.assertEqual(main(['vimgolf', 'config']), 0)
     # The following key is not valid, but it's of the correct form.
     key = '00000000000000000000000000000000'
     self.assertEqual(main(['vimgolf', 'config', key]), 0)
     self.assertEqual(main(['vimgolf', 'config']), 0)
     malformed_key = '0'
     self.assertNotEqual(main(['vimgolf', 'config', malformed_key]), 0)
Пример #2
0
 def test_show_command(self):
     # First 'list', so that a relative ID (e.g., +1) can be used.
     with io.StringIO() as string_io, redirect_stdout(string_io):
         self.assertEqual(main(['vimgolf', 'list', '11:50']), 0)
         entry_counts = [
             int(x.split()[-3]) for x in string_io.getvalue().split('\n')
             if x
         ]
     # Use the challenge with fewest entries to avoid VimGolf Issue #306.
     #   https://github.com/igrigorik/vimgolf/issues/306
     entry = min((x, idx) for idx, x in enumerate(entry_counts))[1] + 1
     self.assertEqual(main(['vimgolf', 'show', '+{}'.format(entry)]), 0)
     # The following ID is for 'Pascal's Triangle'
     # http://www.vimgolf.com/challenges/5ca2bc786b547e000c77fd52
     self.assertEqual(main(['vimgolf', 'show', '5ca2bc786b547e000c77fd52']),
                      0)
     # A workaround was added to avoid VimGolf Issue #306. Test that 'show'
     # works for 'Simple, Practical, and Common', a challenge that has the
     # issue without the workaround.
     # http://www.vimgolf.com/challenges/55b18bbea9c2c30d04000001
     self.assertEqual(main(['vimgolf', 'show', '55b18bbea9c2c30d04000001']),
                      0)
Пример #3
0
import sys

from vimgolf.vimgolf import main

if __name__ == "__main__":
    sys.exit(main())
Пример #4
0
 def test_list_command(self):
     self.assertEqual(main(['vimgolf', 'list']), 0)
Пример #5
0
 def test_version_command(self):
     self.assertEqual(main(['vimgolf', 'version']), 0)
Пример #6
0
 def test_help_command(self):
     self.assertEqual(main(['vimgolf', 'help']), 0)