def test_handles_endstatus(self):
     """Tests that END is handled properly."""
     for stat in self.statuses:
         line = version_1.status_line(0, 'END ' + stat, '----', 'test', '',
                                      {})
         self.assertEquals(line.type, 'END')
         self.assertEquals(line.status, stat)
Example #2
0
 def test_get_timestamp_returns_timestamp_field(self):
     timestamp = datetime.datetime(1970, 1, 1, 4, 30)
     timestamp -= datetime.timedelta(seconds=time.timezone)
     line = version_1.status_line(0, "GOOD", "subdir", "testname",
                                  "reason text",
                                  {"timestamp": "16200"})
     self.assertEquals(timestamp, line.get_timestamp())
 def test_get_timestamp_returns_timestamp_field(self):
     """Tests that get_timestamp returns the expected info."""
     timestamp = datetime.datetime(1970, 1, 1, 4, 30)
     timestamp -= datetime.timedelta(seconds=time.timezone)
     line = version_1.status_line(0, 'GOOD', 'subdir', 'testname',
                                  'reason text', {'timestamp': '16200'})
     self.assertEquals(timestamp, line.get_timestamp())
 def test_get_kernel_returns_unknown_with_no_kernel(self):
     line = version_1.status_line(
         0, "GOOD", "subdir", "testname", "reason text", {"patch0": "first_patch 0 0", "patch2": "another_patch 0 0"}
     )
     kern = line.get_kernel()
     self.assertEquals(kern.base, "UNKNOWN")
     self.assertEquals(kern.patches, [])
     self.assertEquals(kern.kernel_hash, "UNKNOWN")
Example #5
0
 def test_get_kernel_returns_unknown_with_no_kernel(self):
     """Tests that a missing kernel is handled properly."""
     line = version_1.status_line(0, 'GOOD', 'subdir', 'testname',
                                  'reason text',
                                  {'patch0': 'first_patch 0 0',
                                   'patch2': 'another_patch 0 0'})
     kern = line.get_kernel()
     self.assertEquals(kern.base, 'UNKNOWN')
     self.assertEquals(kern.patches, [])
     self.assertEquals(kern.kernel_hash, 'UNKNOWN')
Example #6
0
 def test_get_kernel_returns_unknown_with_no_kernel(self):
     line = version_1.status_line(0, "GOOD", "subdir", "testname",
                                  "reason text", {
                                      "patch0": "first_patch 0 0",
                                      "patch2": "another_patch 0 0"
                                  })
     kern = line.get_kernel()
     self.assertEquals(kern.base, "UNKNOWN")
     self.assertEquals(kern.patches, [])
     self.assertEquals(kern.kernel_hash, "UNKNOWN")
Example #7
0
 def test_get_kernel_ignores_out_of_sequence_patches(self):
     line = version_1.status_line(0, "GOOD", "subdir", "testname",
                                  "reason text",
                                  {"kernel": "2.6.24-rc40",
                                   "patch0": "first_patch 0 0",
                                   "patch2": "another_patch 0 0"})
     kern = line.get_kernel()
     kernel_hash = md5.new("2.6.24-rc40,0").hexdigest()
     self.assertEquals(kern.base, "2.6.24-rc40")
     self.assertEquals(kern.patches[0].spec, "first_patch")
     self.assertEquals(len(kern.patches), 1)
     self.assertEquals(kern.kernel_hash, kernel_hash)
Example #8
0
 def test_get_kernel_ignores_out_of_sequence_patches(self):
     line = version_1.status_line(
         0, "GOOD", "subdir", "testname", "reason text", {
             "kernel": "2.6.24-rc40",
             "patch0": "first_patch 0 0",
             "patch2": "another_patch 0 0"
         })
     kern = line.get_kernel()
     kernel_hash = utils.hash("md5", "2.6.24-rc40,0").hexdigest()
     self.assertEquals(kern.base, "2.6.24-rc40")
     self.assertEquals(kern.patches[0].spec, "first_patch")
     self.assertEquals(len(kern.patches), 1)
     self.assertEquals(kern.kernel_hash, kernel_hash)
Example #9
0
 def test_get_kernel_ignores_out_of_sequence_patches(self):
     """Tests that get_kernel ignores patches that are out of sequence."""
     line = version_1.status_line(0, 'GOOD', 'subdir', 'testname',
                                  'reason text',
                                  {'kernel': '2.6.24-rc40',
                                   'patch0': 'first_patch 0 0',
                                   'patch2': 'another_patch 0 0'})
     kern = line.get_kernel()
     kernel_hash = utils.hash('md5', '2.6.24-rc40,0').hexdigest()
     self.assertEquals(kern.base, '2.6.24-rc40')
     self.assertEquals(kern.patches[0].spec, 'first_patch')
     self.assertEquals(len(kern.patches), 1)
     self.assertEquals(kern.kernel_hash, kernel_hash)
Example #10
0
 def test_get_kernel_returns_kernel_plus_patches(self):
     line = version_1.status_line(0, "GOOD", "subdir", "testname",
                                  "reason text",
                                  {"kernel": "2.6.24-rc40",
                                   "patch0": "first_patch 0 0",
                                   "patch1": "another_patch 0 0"})
     kern = line.get_kernel()
     kernel_hash = utils.hash("md5", "2.6.24-rc40,0,0").hexdigest()
     self.assertEquals(kern.base, "2.6.24-rc40")
     self.assertEquals(kern.patches[0].spec, "first_patch")
     self.assertEquals(kern.patches[1].spec, "another_patch")
     self.assertEquals(len(kern.patches), 2)
     self.assertEquals(kern.kernel_hash, kernel_hash)
Example #11
0
 def test_get_kernel_returns_kernel_plus_patches(self):
     """Tests that get_kernel returns the appropriate info."""
     line = version_1.status_line(0, 'GOOD', 'subdir', 'testname',
                                  'reason text',
                                  {'kernel': '2.6.24-rc40',
                                   'patch0': 'first_patch 0 0',
                                   'patch1': 'another_patch 0 0'})
     kern = line.get_kernel()
     kernel_hash = utils.hash('md5', '2.6.24-rc40,0,0').hexdigest()
     self.assertEquals(kern.base, '2.6.24-rc40')
     self.assertEquals(kern.patches[0].spec, 'first_patch')
     self.assertEquals(kern.patches[1].spec, 'another_patch')
     self.assertEquals(len(kern.patches), 2)
     self.assertEquals(kern.kernel_hash, kernel_hash)
Example #12
0
 def test_saves_all_fields(self):
     line = version_1.status_line(5, "GOOD", "subdir_name",
                                  "test_name", "my reason here",
                                  {"key1": "value",
                                   "key2": "another value",
                                   "key3": "value3"})
     self.assertEquals(line.indent, 5)
     self.assertEquals(line.status, "GOOD")
     self.assertEquals(line.subdir, "subdir_name")
     self.assertEquals(line.testname, "test_name")
     self.assertEquals(line.reason, "my reason here")
     self.assertEquals(line.optional_fields,
                       {"key1": "value", "key2": "another value",
                        "key3": "value3"})
Example #13
0
 def test_saves_all_fields(self):
     """Tests that all fields are saved."""
     line = version_1.status_line(5, 'GOOD', 'subdir_name',
                                  'test_name', 'my reason here',
                                  {'key1': 'value',
                                   'key2': 'another value',
                                   'key3': 'value3'})
     self.assertEquals(line.indent, 5)
     self.assertEquals(line.status, 'GOOD')
     self.assertEquals(line.subdir, 'subdir_name')
     self.assertEquals(line.testname, 'test_name')
     self.assertEquals(line.reason, 'my reason here')
     self.assertEquals(line.optional_fields,
                       {'key1': 'value', 'key2': 'another value',
                        'key3': 'value3'})
Example #14
0
 def test_saves_all_fields(self):
     line = version_1.status_line(5, "GOOD", "subdir_name", "test_name",
                                  "my reason here", {
                                      "key1": "value",
                                      "key2": "another value",
                                      "key3": "value3"
                                  })
     self.assertEquals(line.indent, 5)
     self.assertEquals(line.status, "GOOD")
     self.assertEquals(line.subdir, "subdir_name")
     self.assertEquals(line.testname, "test_name")
     self.assertEquals(line.reason, "my reason here")
     self.assertEquals(line.optional_fields, {
         "key1": "value",
         "key2": "another value",
         "key3": "value3"
     })
 def test_get_timestamp_returns_none_on_missing_field(self):
     """Tests that get_timestamp returns None if no timestamp exists."""
     line = version_1.status_line(0, 'GOOD', 'subdir', 'testname',
                                  'reason text', {})
     self.assertEquals(None, line.get_timestamp())
Example #16
0
 def test_bad_reboot_passes_success_test(self):
     line = version_1.status_line(0, "NOSTATUS", None, "reboot",
                                  "reboot success", {})
     self.assertEquals(line.is_successful_reboot("FAIL"), False)
     self.assertEquals(line.is_successful_reboot("ABORT"), False)
Example #17
0
 def test_handles_start(self):
     line = version_1.status_line(0, "START", "----", "test", "", {})
     self.assertEquals(line.type, "START")
     self.assertEquals(line.status, None)
Example #18
0
 def test_parses_blank_testname(self):
     line = version_1.status_line(0, "GOOD", "subdir", "----",
                                  "", {})
     self.assertEquals(line.testname, None)
Example #19
0
 def test_good_reboot_passes_success_test(self):
     line = version_1.status_line(0, "NOSTATUS", None, "reboot",
                                  "reboot success", {})
     self.assertEquals(line.is_successful_reboot("GOOD"), True)
     self.assertEquals(line.is_successful_reboot("WARN"), True)
Example #20
0
 def test_get_timestamp_returns_none_on_missing_field(self):
     line = version_1.status_line(0, "GOOD", "subdir", "testname",
                                  "reason text", {})
     self.assertEquals(None, line.get_timestamp())
Example #21
0
 def test_handles_start(self):
     line = version_1.status_line(0, "START", "----", "test",
                                  "", {})
     self.assertEquals(line.type, "START")
     self.assertEquals(line.status, None)
 def test_handles_start(self):
     """Tests that START is handled properly."""
     line = version_1.status_line(0, 'START', '----', 'test', '', {})
     self.assertEquals(line.type, 'START')
     self.assertEquals(line.status, None)
Example #23
0
 def test_handles_endstatus(self):
     for stat in self.statuses:
         line = version_1.status_line(0, "END " + stat, "----",
                                      "test", "", {})
         self.assertEquals(line.type, "END")
         self.assertEquals(line.status, stat)
 def test_parses_blank_subdir(self):
     """Tests that a blank subdirectory is parsed properly."""
     line = version_1.status_line(0, 'GOOD', '----', 'test', '', {})
     self.assertEquals(line.subdir, None)
Example #25
0
 def test_handles_endstatus(self):
     for stat in self.statuses:
         line = version_1.status_line(0, "END " + stat, "----", "test", "",
                                      {})
         self.assertEquals(line.type, "END")
         self.assertEquals(line.status, stat)
Example #26
0
 def test_parses_blank_subdir(self):
     line = version_1.status_line(0, "GOOD", "----", "test", "", {})
     self.assertEquals(line.subdir, None)
Example #27
0
 def test_bad_reboot_passes_success_test(self):
     line = version_1.status_line(0, "NOSTATUS", None, "reboot",
                                  "reboot success", {})
     self.assertEquals(line.is_successful_reboot("FAIL"), False)
     self.assertEquals(line.is_successful_reboot("ABORT"), False)
Example #28
0
 def test_good_reboot_passes_success_test(self):
     line = version_1.status_line(0, "NOSTATUS", None, "reboot",
                                  "reboot success", {})
     self.assertEquals(line.is_successful_reboot("GOOD"), True)
     self.assertEquals(line.is_successful_reboot("WARN"), True)
 def test_handles_info(self):
     """Tests that INFO is handled properly."""
     line = version_1.status_line(0, 'INFO', '----', '----', '', {})
     self.assertEquals(line.type, 'INFO')
     self.assertEquals(line.status, None)
 def test_good_reboot_passes_success_test(self):
     """Tests good reboot statuses."""
     line = version_1.status_line(0, 'NOSTATUS', None, 'reboot',
                                  'reboot success', {})
     self.assertEquals(line.is_successful_reboot('GOOD'), True)
     self.assertEquals(line.is_successful_reboot('WARN'), True)
Example #31
0
 def test_get_timestamp_returns_timestamp_field(self):
     timestamp = datetime.datetime(1970, 1, 1, 4, 30)
     timestamp -= datetime.timedelta(seconds=time.timezone)
     line = version_1.status_line(0, "GOOD", "subdir", "testname",
                                  "reason text", {"timestamp": "16200"})
     self.assertEquals(timestamp, line.get_timestamp())
Example #32
0
 def test_parses_blank_subdir(self):
     line = version_1.status_line(0, "GOOD", "----", "test",
                                  "", {})
     self.assertEquals(line.subdir, None)
Example #33
0
 def test_handles_info(self):
     line = version_1.status_line(0, "INFO", "----", "----", "", {})
     self.assertEquals(line.type, "INFO")
     self.assertEquals(line.status, None)
 def test_parses_blank_testname(self):
     """Tests that a blank test name is parsed properly."""
     line = version_1.status_line(0, 'GOOD', 'subdir', '----', '', {})
     self.assertEquals(line.testname, None)
Example #35
0
 def test_get_timestamp_returns_none_on_missing_field(self):
     line = version_1.status_line(0, "GOOD", "subdir", "testname",
                                  "reason text", {})
     self.assertEquals(None, line.get_timestamp())
 def test_bad_reboot_passes_success_test(self):
     """Tests bad reboot statuses."""
     line = version_1.status_line(0, 'NOSTATUS', None, 'reboot',
                                  'reboot success', {})
     self.assertEquals(line.is_successful_reboot('FAIL'), False)
     self.assertEquals(line.is_successful_reboot('ABORT'), False)
Example #37
0
 def test_parses_blank_testname(self):
     line = version_1.status_line(0, "GOOD", "subdir", "----", "", {})
     self.assertEquals(line.testname, None)
Example #38
0
 def test_handles_info(self):
     line = version_1.status_line(0, "INFO", "----", "----",
                                  "", {})
     self.assertEquals(line.type, "INFO")
     self.assertEquals(line.status, None)