| @@ 136-172 (lines=37) @@ | ||
| 133 | '</modify_user>' |
|
| 134 | ) |
|
| 135 | ||
| 136 | def test_modify_user_with_hosts(self): |
|
| 137 | self.gmp.modify_user(user_id='u1', hosts=[]) |
|
| 138 | ||
| 139 | self.connection.send.has_been_called_with('<modify_user user_id="u1"/>') |
|
| 140 | ||
| 141 | self.gmp.modify_user(user_id='u1', hosts=['foo']) |
|
| 142 | ||
| 143 | self.connection.send.has_been_called_with( |
|
| 144 | '<modify_user user_id="u1">' |
|
| 145 | '<hosts allow="0">foo</hosts>' |
|
| 146 | '</modify_user>' |
|
| 147 | ) |
|
| 148 | ||
| 149 | self.gmp.modify_user(user_id='u1', hosts=['foo', 'bar']) |
|
| 150 | ||
| 151 | self.connection.send.has_been_called_with( |
|
| 152 | '<modify_user user_id="u1">' |
|
| 153 | '<hosts allow="0">foo,bar</hosts>' |
|
| 154 | '</modify_user>' |
|
| 155 | ) |
|
| 156 | ||
| 157 | self.gmp.modify_user( |
|
| 158 | user_id='u1', hosts=['foo', 'bar'], hosts_allow=False |
|
| 159 | ) |
|
| 160 | ||
| 161 | self.connection.send.has_been_called_with( |
|
| 162 | '<modify_user user_id="u1">' |
|
| 163 | '<hosts allow="0">foo,bar</hosts>' |
|
| 164 | '</modify_user>' |
|
| 165 | ) |
|
| 166 | ||
| 167 | self.gmp.modify_user( |
|
| 168 | user_id='u1', hosts=['foo', 'bar'], hosts_allow=True |
|
| 169 | ) |
|
| 170 | ||
| 171 | self.connection.send.has_been_called_with( |
|
| 172 | '<modify_user user_id="u1">' |
|
| 173 | '<hosts allow="1">foo,bar</hosts>' |
|
| 174 | '</modify_user>' |
|
| 175 | ) |
|
| @@ 118-154 (lines=37) @@ | ||
| 115 | '</modify_user>' |
|
| 116 | ) |
|
| 117 | ||
| 118 | def test_modify_user_with_hosts(self): |
|
| 119 | self.gmp.modify_user(user_id='u1', hosts=[]) |
|
| 120 | ||
| 121 | self.connection.send.has_been_called_with('<modify_user user_id="u1"/>') |
|
| 122 | ||
| 123 | self.gmp.modify_user(user_id='u1', hosts=['foo']) |
|
| 124 | ||
| 125 | self.connection.send.has_been_called_with( |
|
| 126 | '<modify_user user_id="u1">' |
|
| 127 | '<hosts allow="0">foo</hosts>' |
|
| 128 | '</modify_user>' |
|
| 129 | ) |
|
| 130 | ||
| 131 | self.gmp.modify_user(user_id='u1', hosts=['foo', 'bar']) |
|
| 132 | ||
| 133 | self.connection.send.has_been_called_with( |
|
| 134 | '<modify_user user_id="u1">' |
|
| 135 | '<hosts allow="0">foo,bar</hosts>' |
|
| 136 | '</modify_user>' |
|
| 137 | ) |
|
| 138 | ||
| 139 | self.gmp.modify_user( |
|
| 140 | user_id='u1', hosts=['foo', 'bar'], hosts_allow=False |
|
| 141 | ) |
|
| 142 | ||
| 143 | self.connection.send.has_been_called_with( |
|
| 144 | '<modify_user user_id="u1">' |
|
| 145 | '<hosts allow="0">foo,bar</hosts>' |
|
| 146 | '</modify_user>' |
|
| 147 | ) |
|
| 148 | ||
| 149 | self.gmp.modify_user( |
|
| 150 | user_id='u1', hosts=['foo', 'bar'], hosts_allow=True |
|
| 151 | ) |
|
| 152 | ||
| 153 | self.connection.send.has_been_called_with( |
|
| 154 | '<modify_user user_id="u1">' |
|
| 155 | '<hosts allow="1">foo,bar</hosts>' |
|
| 156 | '</modify_user>' |
|
| 157 | ) |
|