def test_actions_are_reported(self, m_gc, m_gca, m_gii): """it just reports the actions as given""" # mock as hell. proof of bad design m_gc.return_value = ["uno", "dos", "tes"] m_gca.side_effect = [["aa", "ab"], ["ba", "bb"], ["ca", "cb"]] m_gii.side_effect = ["pic1.png", "pic2.png", "pic3.png"] expectations = [{ 'image': 'pic1.png', 'name': 'uno', 'actions': ['aa', 'ab'] }, { 'image': 'pic2.png', 'name': 'dos', 'actions': ['ba', 'bb'] }, { 'image': 'pic3.png', 'name': 'tes', 'actions': ['ca', 'cb'] }] # run something, for mocks sake results = get_all_actions("foo") eq_(results, expectations) assert m_gca.called is True assert m_gc.called is True assert m_gii.called is True
def desktop(): """ this route displays a list of available services to the user """ dhome = expanduser(app.config["DOCKER_SERVICES_HOME"]) return render_template( "desktop.html", data={ "services": get_all_actions(dhome), "debug": { "enabled": app.config["DEBUG"], "data": { "docker_home": dhome, "listing": do_run("cat {0}/docker.compose_ui/Makefile".format(dhome))} } } )
def test_actions_are_reported(self, m_gc, m_gca, m_gii): """it just reports the actions as given""" # mock as hell. proof of bad design m_gc.return_value = ["uno","dos","tes"] m_gca.side_effect = [["aa","ab"], ["ba","bb"], ["ca","cb"]] m_gii.side_effect = ["pic1.png","pic2.png","pic3.png"] expectations = [ {'image': 'pic1.png', 'name': 'uno', 'actions': ['aa', 'ab']}, {'image': 'pic2.png', 'name': 'dos', 'actions': ['ba', 'bb']}, {'image': 'pic3.png', 'name': 'tes', 'actions': ['ca', 'cb']} ] # run something, for mocks sake results = get_all_actions("foo") eq_(results, expectations) assert m_gca.called is True assert m_gc.called is True assert m_gii.called is True
def desktop(): """ this route displays a list of available services to the user """ dhome = expanduser(app.config["DOCKER_SERVICES_HOME"]) return render_template( "desktop.html", data={ "services": get_all_actions(dhome), "debug": { "enabled": app.config["DEBUG"], "data": { "docker_home": dhome, "listing": do_run("cat {0}/docker.compose_ui/Makefile".format(dhome)) } } })