Beispiel #1
0
class RunAdapterTestCase(TestCase):

    @setup
    def setup_adapter(self):
        self.original           = mock.Mock()
        self.adapter            = RunAdapter(self.original)

    def test_get_state(self):
        assert_equal(self.adapter.get_state(), self.original.state.short_name)

    def test_get_node(self):
        assert_equal(self.adapter.get_node(), str(self.original.node))

    def test_get_duration(self):
        self.original.start_time = None
        assert_equal(self.adapter.get_duration(), '')
Beispiel #2
0
class RunAdapterTestCase(TestCase):

    @setup
    def setup_adapter(self):
        self.original           = Turtle()
        self.adapter            = RunAdapter(self.original)

    def test_get_state(self):
        assert_equal(self.adapter.get_state(), self.original.state.short_name)

    def test_get_node(self):
        hostname = self.adapter.get_node()
        assert_equal(hostname, self.original.node.hostname)

    def test_get_duration(self):
        self.original.start_time = None
        assert_equal(self.adapter.get_duration(), '')
Beispiel #3
0
class RunAdapterTestCase(TestCase):

    @setup
    def setup_adapter(self):
        self.original           = mock.Mock()
        self.adapter            = RunAdapter(self.original)

    def test_get_state(self):
        assert_equal(self.adapter.get_state(), self.original.state.name)

    @mock.patch('tron.api.adapter.NodeAdapter', autospec=True)
    def test_get_node(self, mock_node_adapter):
        assert_equal(self.adapter.get_node(),
            mock_node_adapter.return_value.get_repr.return_value)
        mock_node_adapter.assert_called_with(self.original.node)

    def test_get_duration(self):
        self.original.start_time = None
        assert_equal(self.adapter.get_duration(), '')
Beispiel #4
0
 def setup_adapter(self):
     self.original = mock.Mock()
     self.adapter = RunAdapter(self.original)
Beispiel #5
0
 def setup_adapter(self):
     self.original = mock.Mock()
     self.adapter = RunAdapter(self.original)
Beispiel #6
0
 def setup_adapter(self):
     self.original           = Turtle()
     self.adapter            = RunAdapter(self.original)