~nskaggs/juju-ci-tools/add-assess-terms

« back to all changes in this revision

Viewing changes to assess_block.py

  • Committer: Curtis Hovey
  • Date: 2016-11-14 20:10:26 UTC
  • mto: This revision was merged to the branch mainline in revision 1726.
  • Revision ID: curtis@canonical.com-20161114201026-315ys51e1ct7f413
Rename disable_command_* to command_set_*.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    """Return a manually made list of blocks and their status
32
32
 
33
33
    :param client: The client whose rules will be used.
34
 
    :param disabled_commands: list of client.disable_command_* elements to
 
34
    :param disabled_commands: list of client.command_set_* elements to
35
35
        include in simulated output.
36
36
    """
37
 
    if client.is_juju1x():
 
37
    if isinstance(client, EnvJujuClient1X):
38
38
        blocks = []
39
39
        commands = [
40
 
            EnvJujuClient1X.disable_command_destroy_model,
41
 
            EnvJujuClient1X.disable_command_remove_object,
42
 
            EnvJujuClient1X.disable_command_all]
 
40
            client.command_set_destroy_model,
 
41
            client.command_set_remove_object,
 
42
            client.command_set_all]
43
43
        for command in commands:
44
44
            if command in disabled_commands:
45
45
                blocks.append({
84
84
    client.disable_command(client.destroy_model_command)
85
85
    block_list = client.list_disabled_commands()
86
86
    if block_list != make_block_list(
87
 
            client, [client.disable_command_destroy_model]):
 
87
            client, [client.command_set_destroy_model]):
88
88
        raise JujuAssertionError(block_list)
89
89
    test_disabled(
90
90
        client, client.destroy_model_command,
100
100
    objects can be added and related, but they
101
101
    cannot be removed or the model/environment deleted.
102
102
    """
103
 
    client.disable_command(client.disable_command_remove_object)
 
103
    client.disable_command(client.command_set_remove_object)
104
104
    block_list = client.list_disabled_commands()
105
105
    if block_list != make_block_list(
106
 
            client, [client.disable_command_remove_object]):
 
106
            client, [client.command_set_remove_object]):
107
107
        raise JujuAssertionError(block_list)
108
108
    test_disabled(
109
109
        client, client.destroy_model_command,
118
118
def assess_block_all_changes(client, charm_series):
119
119
    """Test Block Functionality: block all-changes"""
120
120
    client.juju('remove-relation', ('dummy-source', 'dummy-sink'))
121
 
    client.disable_command(client.disable_command_all)
 
121
    client.disable_command(client.command_set_all)
122
122
    block_list = client.list_disabled_commands()
123
 
    if block_list != make_block_list(client, [client.disable_command_all]):
 
123
    if block_list != make_block_list(client, [client.command_set_all]):
124
124
        raise JujuAssertionError(block_list)
125
125
    test_disabled(client, 'add-relation', ('dummy-source', 'dummy-sink'))
126
126
    test_disabled(client, 'unexpose', ('dummy-sink',))
127
127
    test_disabled(client, 'remove-service', 'dummy-sink')
128
 
    client.enable_command(client.disable_command_all)
 
128
    client.enable_command(client.command_set_all)
129
129
    client.juju('unexpose', ('dummy-sink',))
130
 
    client.disable_command(client.disable_command_all)
 
130
    client.disable_command(client.command_set_all)
131
131
    test_disabled(client, 'expose', ('dummy-sink',))
132
 
    client.enable_command(client.disable_command_all)
 
132
    client.enable_command(client.command_set_all)
133
133
    client.remove_service('dummy-sink')
134
134
    client.wait_for_started()
135
 
    client.disable_command(client.disable_command_all)
 
135
    client.disable_command(client.command_set_all)
136
136
    test_disabled(client, 'deploy', ('dummy-sink',))
137
137
    test_disabled(
138
138
        client, client.destroy_model_command,
168
168
    assess_block_destroy_model(client, charm_series)
169
169
    assess_unblock(client, client.destroy_model_command)
170
170
    assess_block_remove_object(client, charm_series)
171
 
    assess_unblock(client, client.disable_command_remove_object)
 
171
    assess_unblock(client, client.command_set_remove_object)
172
172
    assess_block_all_changes(client, charm_series)
173
 
    assess_unblock(client, client.disable_command_all)
 
173
    assess_unblock(client, client.command_set_all)
174
174
    log.info('Test PASS')
175
175
 
176
176