コード例 #1
0
ファイル: test_clusters.py プロジェクト: hyuni/mycroft
def test_cluster_by_name(cluster_name, parm):
    dr = dummy_request()
    dr.matchdict["cluster_name"] = cluster_name
    expected_return_code = 200
    with patch("mycroft.models.aws_connections.TableConnection.get_connection"):
        with patch(parm) as list_action:
            list_action.return_value = {}
            actual_return_code, _ = cluster_by_name(dr)
        assert actual_return_code == expected_return_code
コード例 #2
0
ファイル: test_clusters.py プロジェクト: hyuni/mycroft
def test_cluster_by_name_errors(err_instance, expected_return_code):
    dr = dummy_request()
    dr.matchdict["log_name"] = "dummy_log_name"

    with patch("mycroft.models.aws_connections.TableConnection.get_connection"):
        with patch("mycroft.views.clusters.list_cluster_by_name") as list_action:
            list_action.side_effect = err_instance
            actual_return_code, _ = cluster_by_name(dr)
        assert actual_return_code == expected_return_code