Esempio n. 1
0
class DisplayServicesTestCase(TestCase):
    @setup
    def setup_data(self):
        self.data = [
            dict(name="My Service",
                 state="stopped",
                 live_count="4",
                 enabled=True),
            dict(name="Another Service",
                 state="running",
                 live_count="2",
                 enabled=False),
            dict(name="Yet another",
                 state="running",
                 live_count="1",
                 enabled=True)
        ]
        self.display = DisplayServices()

    def test_format(self):
        out = self.display.format(self.data)
        lines = out.split('\n')
        assert_equal(len(lines), 6)
        assert lines[3].startswith('Another')

    def test_format_no_data(self):
        out = self.display.format([])
        lines = out.split("\n")
        assert_equal(len(lines), 4)
        assert_equal(lines[2], 'No Services')
Esempio n. 2
0
 def setup_data(self):
     self.data = [
         dict(name="My Service",
              state="stopped",
              live_count="4",
              enabled=True),
         dict(name="Another Service",
              state="running",
              live_count="2",
              enabled=False),
         dict(name="Yet another",
              state="running",
              live_count="1",
              enabled=True)
     ]
     self.display = DisplayServices()
Esempio n. 3
0
 def setup_data(self):
     self.data = [
         dict(name="My Service",      state="stopped", live_count="4", owner="alice", enabled=True),
         dict(name="Another Service", state="running", live_count="2", owner="bob",   enabled=False),
         dict(name="Yet another",     state="running", live_count="1", owner="ted",   enabled=True)
     ]
     self.display = DisplayServices()
Esempio n. 4
0
 def setup_data(self):
     Color.enabled = True
     self.data = [
         dict(name="My Service", status="stopped", count="4"),
         dict(name="Another Service", status="running", count="2"),
         dict(name="Yet another", status="running", count="1")
     ]
     self.display = DisplayServices(80)
Esempio n. 5
0
class DisplayServicesTestCase(TestCase):

    @setup
    def setup_data(self):
        self.data = [
            dict(name="My Service",      state="stopped", live_count="4", owner="alice", enabled=True),
            dict(name="Another Service", state="running", live_count="2", owner="bob",   enabled=False),
            dict(name="Yet another",     state="running", live_count="1", owner="ted",   enabled=True)
        ]
        self.display = DisplayServices()

    def test_format(self):
        out = self.display.format(self.data)
        lines = out.split('\n')
        assert_equal(len(lines), 6)
        assert lines[3].startswith('Another')

    def test_format_no_data(self):
        out = self.display.format([])
        lines = out.split("\n")
        assert_equal(len(lines), 4)
        assert_equal(lines[2], 'No Services')
Esempio n. 6
0
class DisplayServicesTestCase(TestCase):

    @setup
    def setup_data(self):
        Color.enabled = True
        self.data = [
            dict(name="My Service", status="stopped", count="4"),
            dict(name="Another Service", status="running", count="2"),
            dict(name="Yet another", status="running", count="1")
        ]
        self.display = DisplayServices(80)

    def test_format(self):
        out = self.display.format(self.data)
        lines = out.split('\n')
        assert_equal(len(lines), 6)
        assert lines[3].startswith('Another')

    def test_format_no_data(self):
        out = self.display.format([])
        lines = out.split("\n")
        assert_equal(len(lines), 4)
        assert_equal(lines[2], 'No Services')