def test_non_integer_id(self):
     data = [
         'ignored,id,resolution,status',
         'foo,bar,not,complete',
         ]
     parser = MantisBugBatchParser(data, self.logger)
     self.assertThat(parser.getBugs(), Equals({}))
     log = self.logger.getLogBuffer()
     self.assertThat(
         log, Equals("WARNING Encountered invalid bug ID: 'bar'.\n"))
 def test_non_integer_id(self):
     data = [
         'ignored,id,resolution,status',
         'foo,bar,not,complete',
         ]
     parser = MantisBugBatchParser(data, self.logger)
     self.assertThat(parser.getBugs(), Equals({}))
     log = self.logger.getLogBuffer()
     self.assertThat(
         log, Equals("WARNING Encountered invalid bug ID: 'bar'.\n"))
 def test_incomplete_line(self):
     data = [
         'ignored,id,resolution,status',
         '42,not,complete',
         ]
     parser = MantisBugBatchParser(data, self.logger)
     self.assertThat(parser.getBugs(), Equals({}))
     log = self.logger.getLogBuffer()
     self.assertThat(
         log,
         Equals("WARNING Line ['42', 'not', 'complete'] incomplete.\n"))
 def test_incomplete_line(self):
     data = [
         'ignored,id,resolution,status',
         '42,not,complete',
         ]
     parser = MantisBugBatchParser(data, self.logger)
     self.assertThat(parser.getBugs(), Equals({}))
     log = self.logger.getLogBuffer()
     self.assertThat(
         log,
         Equals("WARNING Line ['42', 'not', 'complete'] incomplete.\n"))
 def test_passing(self):
     data = [
         'ignored,id,resolution,status',
         'foo,42,not,complete',
         'boo,13,,confirmed',
         ]
     parser = MantisBugBatchParser(data, self.logger)
     bug_42 = dict(
         id=42, status='complete', resolution='not', ignored='foo')
     bug_13 = dict(
         id=13, status='confirmed', resolution='', ignored='boo')
     self.assertThat(parser.getBugs(), Equals({42: bug_42, 13: bug_13}))
 def test_passing(self):
     data = [
         'ignored,id,resolution,status',
         'foo,42,not,complete',
         'boo,13,,confirmed',
         ]
     parser = MantisBugBatchParser(data, self.logger)
     bug_42 = dict(
         id=42, status='complete', resolution='not', ignored='foo')
     bug_13 = dict(
         id=13, status='confirmed', resolution='', ignored='boo')
     self.assertThat(parser.getBugs(), Equals({42: bug_42, 13: bug_13}))
 def test_empty(self):
     data = []
     parser = MantisBugBatchParser(data, self.logger)
     exc = self.assertRaises(
         UnparsableBugData,
         parser.getBugs)
     self.assertThat(
         str(exc), Equals("Missing header line"))
Exemple #8
0
 def test_missing_some_headers(self):
     data = ['some,headers,status,resolution']
     parser = MantisBugBatchParser(data, self.logger)
     exc = self.assertRaises(UnparsableBugData, parser.getBugs)
     self.assertThat(
         str(exc),
         Equals("CSV header ['some', 'headers', 'status', 'resolution'] "
                "missing fields: ['id']"))
 def test_no_bugs(self):
     data = ['other,fields,id,status,resolution']
     parser = MantisBugBatchParser(data, self.logger)
     self.assertThat(parser.getBugs(), Equals({}))
 def test_no_bugs(self):
     data = ['other,fields,id,status,resolution']
     parser = MantisBugBatchParser(data, self.logger)
     self.assertThat(parser.getBugs(), Equals({}))