armstrong/armstrong.core.arm_layout — pull request #14 by joncotton (2013-10-03 22:15:41+00:00)
Title: Fix random fails in tests

This fixes a problem I've seen for a while. Periodic tests failed because `generate_random_model()` would generate the *same* `randint` on repeated calls. It was bound to happen.

As the function already has `generate` in its name, might as well embrace. Now the function returns a generator of `count` models all guaranteed to have unique titles.

Sample output:
```
>>> from armstrong.core.arm_layout.tests.templatetags import generate_random_model
>>> next(generate_random_model(1)).title
'This is a random title 1852'
>>> [i.title for i in generate_random_model(5)]
['This is a random title 1405', 'This is a random title 1413', 'This is a random title 1432', 'This is a random title 14
51', 'This is a random title 1453']
>>> [i.title for i in generate_random_model(5)]
['This is a random title 1511', 'This is a random title 1515', 'This is a random title 1526', 'This is a random title 15
33', 'This is a random title 1542']
```