Пример #1
0
class ListTest(unittest.TestCase):
    def setUp(self):
        EnvironmentUtil.setup_fresh_test_env()
        self.context = CommandContext.via({'type': 'memory-db'})
        self.listCommand = ListCommand(self.context)

    def tearDown(self):
        EnvironmentUtil.teardown_fresh_test_env()

    def test_order(self):
        id1, id2 = AlterUtil.create_alters([1, 2])
        AlterUtil.run_alters()
        sys.argv = make_argv([])
        result = self.listCommand.run()
        self.assertEqual([id1, id2], result)

    def test_order_reverse(self):
        id1, id2 = AlterUtil.create_alters([1, 2])
        AlterUtil.run_alters()
        sys.argv = make_argv(['-r'])
        result = self.listCommand.run()
        self.assertEqual([id2, id1], result)
Пример #2
0
class ListTest(unittest.TestCase):

    def setUp(self):
        EnvironmentUtil.setup_fresh_test_env()
        self.context = CommandContext.via({
          'type': 'memory-db'})
        self.listCommand = ListCommand(self.context)

    def tearDown(self):
        EnvironmentUtil.teardown_fresh_test_env()

    def test_order(self):
        id1, id2 = AlterUtil.create_alters([1, 2])
        AlterUtil.run_alters()
        sys.argv = make_argv([])
        result = self.listCommand.run()
        self.assertEqual([id1, id2], result)

    def test_order_reverse(self):
        id1, id2 = AlterUtil.create_alters([1, 2])
        AlterUtil.run_alters()
        sys.argv = make_argv(['-r'])
        result = self.listCommand.run()
        self.assertEqual([id2, id1], result)
Пример #3
0
 def setUp(self):
     EnvironmentUtil.setup_fresh_test_env()
     self.context = CommandContext.via({
       'type': 'memory-db'})
     self.listCommand = ListCommand(self.context)
Пример #4
0
 def setUp(self):
     EnvironmentUtil.setup_fresh_test_env()
     self.context = CommandContext.via({'type': 'memory-db'})
     self.listCommand = ListCommand(self.context)
Пример #5
0
 def get_torrents(self):
     list_output = ListCommand().run_command()
     torrent_arr = list_output.split('\n')
     return TorrentList([
         self.parse_torrent_string(arr)
     for arr in torrent_arr[1, -1]])