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