from elisa.core.tests.component_test_case import ComponentTestCase
from elisa.plugins.xmlmenu.actions.videoplay_action import VideoplayAction

from weakref import ref

class StupidModel(object):
    pass

class TestVideoplayAction(ComponentTestCase):

    component_class = VideoplayAction

    def test_running(self):
        model = StupidModel()
        model.uri = 'yehaa'

        self.uri = None
        self.state = None
        self.component.player_model = self
        self.component.model = ref(model)

        self.component(self, None)
        self.assertEquals(self.uri, 'yehaa')
        self.failIf(self.state == None)

