def test_success_case(self): """Return stdout_lines in case of success.""" in_line = 'redhat-620133; redhat-630187\n' self.assertEqual( fuse.ProcessFindJbossCXFJar.process( ansible_result(in_line)), ['redhat-620133', 'redhat-630187'])
def test_eap(self): """'eap' found.""" for processor in self.processors: self.assertEqual( processor.process( ansible_result(' foo\n eap bar\n baz eap')), ['eap bar'])
def test_no_jboss(self): """No 'jboss' or 'eap' found.""" for processor in self.processors: self.assertEqual( # Blank line in input to check that processor will skip it. processor.process(ansible_result('foo\nbar\n\nbaz')), [])
def test_success_case(self): """Return stdout_lines in case of success.""" in_line = '1.3.6.Final-redhat-1**2018-01-18; ' \ '1.3.6.Final-redhat-1**2018-01-18; ' \ '1.3.6.Final-redhat-1**2018-01-18\n' expected = {'version': '1.3.6.Final-redhat-1', 'date': '2018-01-18'} self.assertEqual( eap.ProcessFindJbossEAPRunJarVer.process(ansible_result(in_line)), [expected, expected, expected])
def test_jboss(self): """'jboss' found.""" # This tests that the processor returns the 'jboss bar' line # and that it does *not* return the 'baz jboss' line, becuase # in that line 'jboss' is not in the first piece. for processor in self.processors: self.assertEqual( processor.process( ansible_result(' foo\n jboss bar\n baz jboss')), ['jboss bar'])
def test_success_case(self): """Found subman_consumed.""" self.assertEqual( subman.ProcessSubmanConsumed.process( ansible_result('subnameA - 1\nsubnameB - 2\nsubnameC - 3')), [{ 'name': 'subnameA', 'entitlement_id': '1' }, { 'name': 'subnameB', 'entitlement_id': '2' }, { 'name': 'subnameC', 'entitlement_id': '3' }])
def test__not_found(self): """Did not find cpu model name.""" self.assertEqual(cpu.ProcessCpuModelName.process(ansible_result('')), process.NO_DATA)
def test__not_found(self): """Did not find cpu vendor id.""" self.assertEqual(cpu.ProcessCpuVendorId.process(ansible_result('')), process.NO_DATA)
def test_success_case(self): """Found cpu model name.""" self.assertEqual( cpu.ProcessCpuModelName.process(ansible_result('a\nb\nc')), 'a')
def test__not_found(self): """Did not find cpu family.""" self.assertEqual(cpu.ProcessCpuCpuFamily.process(ansible_result('')), process.NO_DATA)
def test_success_case(self): """Found cpu vendor id.""" self.assertEqual( cpu.ProcessCpuVendorId.process(ansible_result('a\nb\nc')), 'a')
def test_no_processes(self): """No processes found.""" self.assertEqual( eap.ProcessJbossEapProcesses.process(ansible_result('')), 0)
def test_success_case(self): """Found cpu family.""" self.assertEqual( cpu.ProcessCpuCpuFamily.process(ansible_result('a\nb\nc')), 'a')
def test_success_case(self): """Found date file system create.""" self.assertEqual( date.ProcessDateFilesystemCreate.process( ansible_result('a\nb\nc')), 'a')
def test_not_found(self): """Did not find date file system create.""" self.assertEqual(date.ProcessDateMachineId.process(ansible_result('')), process.NO_DATA)
def test_not_found(self): """Did not find cpu model ver.""" self.assertEqual(cpu.ProcessCpuModelVer.process(ansible_result('')), [])
def test_no_such_user(self): """'id' did not find the user.""" self.assertEqual( eap.ProcessIdUJboss.process( ansible_result('id: jboss: no such user', rc=1)), False)
def test_success_case(self): """Found cpu model ver.""" self.assertEqual( cpu.ProcessCpuModelVer.process(ansible_result('a\nb\nc')), ['a', 'b', 'c'])
def test_no_grep(self): """Grep sometimes doesn't appear in the ps output.""" self.assertEqual( eap.ProcessJbossEapProcesses.process(ansible_result('java\nbash')), 1)
def test_found_processes(self): """Found one process.""" self.assertEqual( eap.ProcessJbossEapProcesses.process( ansible_result('java\nbash\ngrep')), 1)
def test_success_case(self): """Found cpu bogomips.""" self.assertEqual( cpu.ProcessCpuBogomips.process(ansible_result('a\nb\nc')), 'a')
def test_user_found(self): """'id' found the user.""" self.assertEqual(eap.ProcessIdUJboss.process(ansible_result('11111')), True)
def test__not_found(self): """Did not find cpu bogomips.""" self.assertEqual(cpu.ProcessCpuBogomips.process(ansible_result('')), process.NO_DATA)
def test_unknown_error(self): """'id' returned an error.""" self.assertEqual( eap.ProcessIdUJboss.process( ansible_result('something went wrong!', rc=1)), process.NO_DATA)
def test_not_found(self): """Did not find date.""" self.assertEqual(date.ProcessDateDate.process(ansible_result('')), process.NO_DATA)
def test_not_found(self): """Did not find subman_consumed.""" self.assertEqual( subman.ProcessSubmanConsumed.process(ansible_result('')), [])
def test_success_case(self): """Found date machine id.""" self.assertEqual( date.ProcessDateMachineId.process(ansible_result('a\nb\nc')), 'a')
def test_success_case(self): """Found date.""" self.assertEqual( date.ProcessDateDate.process(ansible_result('a\nb\nc')), ['a', 'b', 'c'])
def test_success_case(self): """Return stdout_lines in case of success.""" self.assertEqual( brms.ProcessFindBRMSKieWarVer.process(ansible_result('a\nb\nc')), ['a', 'b', 'c'])
def test_not_found(self): """Did not find date file system create.""" self.assertEqual( date.ProcessDateFilesystemCreate.process(ansible_result('')), [])