示例#1
0
def test_JelasticEnvironment_differs_from_api_if_envGroups_is_changed():
    """
    JelasticEnvironment can be instantiated, but some read-only attributes can be read, but not written
    """
    jelenv = JelasticEnvironment()
    jelenv.update_from_env_dict(get_standard_env())
    jelenv.update_env_groups_from_info(["A", "B"])

    jelenv.envGroups.append("C")
    assert jelenv.differs_from_api()
    jelenv.envGroups = ["A", "B"]
    assert not jelenv.differs_from_api()
    jelenv.envGroups.remove("A")
    assert jelenv.differs_from_api()
示例#2
0
def test_JelasticEnvironment_envGroups_change_and_save_will_talk_to_API():
    """
    JelasticEnvironment can be instantiated, but some read-only attributes can be read, but not written
    """
    jelapic()._ = Mock(return_value={
        "env": get_standard_env(),
        "envGroups": []
    }, )

    jelenv = JelasticEnvironment()
    jelenv.update_from_env_dict(get_standard_env())
    jelenv.update_env_groups_from_info(["A", "B"])

    jelenv.envGroups.append("C")
    jelenv.save()
    jelapic()._.assert_called()

    jelapic()._.reset_mock()

    # A second save should not call the API
    jelenv.save()
    jelapic()._.assert_not_called()