21
|
|
|
Robert Bruce Park |
12 years ago
|
 |
|
20
|
|
Fix some AccountManager methods. Fixes lp:1069509
Ok, so I reviewed this in much more depth than previously. This commit:
* Unifies the behavior of disabling and deleting accounts. Now, if you're in UOA, and you flick an account to 'OFF', it's messages will be removed from the model. Similarly, if you outright delete an account, the associated messages are also deleted. Currently we do not make any distinction between a "disabled" and a "deleted" account. In both cases, messages are removed from the model, and no attempts are made to redownload messages from that account, until it is re-enabled later.
* Removes the "refresh callback" from the AccountManager, because that was stupid. It turns out, when an account is enabled, you only need to call 'receive' on that one account, not on all of them together. So this is a nice little efficiency win.
* Updates all the tests to the new API changes.
I tested this thoroughly with friends-service.sh, using UOA to enable, disable, delete, and recreate accounts, and it works great.
The best part is, thanks to my previous work on using Model.insert_sorted instead of Model.append, deleting and re-adding messages to the model doesn't change the order of those messages in the Model.
|
Robert Bruce Park |
12 years ago
|
 |
|
19
|
|
|
Robert Bruce Park |
12 years ago
|
 |
|
18
|
|
|
Robert Bruce Park |
12 years ago
|
 |
|
17
|
|
|
Robert Bruce Park |
12 years ago
|
 |
|
16
|
|
|
Robert Bruce Park |
12 years ago
|
 |
|
15
|
|
|
Robert Bruce Park |
12 years ago
|
 |
|
14
|
|
|
Ken VanDine |
12 years ago
|
 |
|
13
|
|
|
Barry Warsaw |
12 years ago
|
 |
|
12
|
|
|
Barry Warsaw |
12 years ago
|
 |
|
11
|
|
|
Barry Warsaw |
12 years ago
|
 |
|
10
|
|
|
Barry Warsaw |
12 years ago
|
 |
|
9
|
|
|
Barry Warsaw |
12 years ago
|
 |
|
8
|
|
Merge lp:~ken-vandine/friends/unsupported_handling which allows AccountManager.add_new_account() to log and ignore UnsupportedProtocolErrors. This is necessary because of the packaging requirement that protocols be installable by separate binary packages.
This means, if friends-service-twitter (or the moral equivalent) is not installed, the user may still have a Twitter account enabled, but there will be no friends-service available for Twitter. This raises an UnsupportedProtocolError, but that's fine, and to be expected.
I had to fix a couple of other things along the way:
* Allow LogMock to work as a context manager (i.e. in a `with` statement). Use it this way if you want to narrow down the capturing of log messages. * Convert a few uses of LogMock from setUp()s to with-statements. * Instead of setting the mock logger level at NOTSET, set it to the value 1. NOTSET==0, but this propagates log messages to the root logger, even if propagate=False, so it's not quite what we want to do. Unfortunately, this also meant the log mocks are now capturing more output, but that's fine, I adjusted the appropriate tests. * Fix test_account_manager_add_new_account_unsupported() to capture and check the log messages. This proved that the test wasn't actually testing what it thought it was testing. Now fixed. * Fixed add_new_account() to narrow down the try/except clause.
|
Barry Warsaw |
12 years ago
|
 |
|
7
|
|
|
Barry Warsaw |
12 years ago
|
 |
|
6
|
|
|
Barry Warsaw |
12 years ago
|
 |
|
5
|
|
|
Barry Warsaw |
12 years ago
|
 |
|
4
|
|
|
Barry Warsaw |
12 years ago
|
 |
|
3
|
|
|
Robert Bruce Park |
12 years ago
|
 |
|
2
|
|
|
Robert Bruce Park |
12 years ago
|
 |
|