예제 #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(), '')
예제 #2
0
파일: adapter_test.py 프로젝트: Bklyn/Tron
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(), '')
예제 #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(), '')