Ejemplo n.º 1
0
 def test_set_option_destdir(self):
     """testing set_option()."""
     command.set_option(self.parser, 'destdir')
     self.assertEqual('/tmp',
                      self.parser.parse_args('-d /tmp'.split()).destdir)
     self.assertEqual('/tmp/foo',
                      self.parser.parse_args(
                          '--destdir /tmp/foo'.split()).destdir)
Ejemplo n.º 2
0
 def test_set_option_destdir(self):
     """testing set_option()."""
     command.set_option(self.parser, 'destdir')
     self.assertEqual('/tmp',
                      self.parser.parse_args('-d /tmp'.split()).destdir)
     self.assertEqual(
         '/tmp/foo',
         self.parser.parse_args('--destdir /tmp/foo'.split()).destdir)
Ejemplo n.º 3
0
 def test_set_option_template_path(self):
     """testing set_option()."""
     command.set_option(self.parser, 'template_path')
     self.assertEqual('address.mastache',
                      self.parser.parse_args(
                          '-t address.mastache'.split()).template_path)
     self.assertEqual('address.mastache',
                      self.parser.parse_args(
                          '--template_path '
                          'address.mastache'.split()).template_path)
Ejemplo n.º 4
0
 def test_set_option_template_path(self):
     """testing set_option()."""
     command.set_option(self.parser, 'template_path')
     self.assertEqual(
         'address.mastache',
         self.parser.parse_args(
             '-t address.mastache'.split()).template_path)
     self.assertEqual(
         'address.mastache',
         self.parser.parse_args('--template_path '
                                'address.mastache'.split()).template_path)
Ejemplo n.º 5
0
    def test_set_option(self):
        c.set_option(self.prs, 'destdir')

        self.assertTrue(
            isinstance(
                self.prs.__dict__.get('_option_string_actions').get('-d'),
                argparse._StoreAction)
            )

        c.set_option(self.prs, 'template_path')
        self.assertTrue(
            isinstance(
                self.prs.__dict__.get('_option_string_actions').get('-t'),
                argparse._StoreAction)
            )
Ejemplo n.º 6
0
 def test_generate_atena(self):
     """testing generate_atena()."""
     command.set_option(self.parser, 'destdir')
     command.set_option(self.parser, 'template_path')
     command.set_option(self.parser, 'address_list')
     args = self.parser.parse_args('-d /tmp/ '
                                   '-t template/address.mustache '
                                   'example/address.csv'.split())
     control.generate_atena(args)
     self.assertTrue(os.path.exists('/tmp/address.tex'))
Ejemplo n.º 7
0
 def test_set_option_address_list(self):
     """testing set_option()."""
     command.set_option(self.parser, 'address_list')
     self.assertEqual('address.csv',
                      self.parser.parse_args(
                          'address.csv'.split()).address_list)
Ejemplo n.º 8
0
 def test_set_option_address_list(self):
     """testing set_option()."""
     command.set_option(self.parser, 'address_list')
     self.assertEqual(
         'address.csv',
         self.parser.parse_args('address.csv'.split()).address_list)