Test that creating a model from a given data instance with client groups correctly sets up the client groups in the model.
(ok_small)
| 677 | |
| 678 | |
| 679 | def test_from_data_client_group(ok_small): |
| 680 | """ |
| 681 | Test that creating a model from a given data instance with client groups |
| 682 | correctly sets up the client groups in the model. |
| 683 | """ |
| 684 | clients = ok_small.clients() |
| 685 | clients[0] = Client(1, 1, delivery=[1], required=False, group=0) |
| 686 | clients[1] = Client(1, 1, delivery=[1], required=False, group=0) |
| 687 | |
| 688 | group = ClientGroup([1, 2]) |
| 689 | |
| 690 | data = ok_small.replace(clients=clients, groups=[group]) |
| 691 | model = Model.from_data(data) |
| 692 | |
| 693 | # Test that the clients have been correctly registered, and that there is |
| 694 | # a client group in the model. |
| 695 | assert_equal(model.clients[0].group, 0) |
| 696 | assert_equal(model.clients[1].group, 0) |
| 697 | assert_equal(len(model.groups), 1) |
| 698 | |
| 699 | # Test that that group actually contains the clients. |
| 700 | group = model.groups[0] |
| 701 | assert_(group.required) |
| 702 | assert_equal(len(group), 2) |
| 703 | assert_equal(group.clients, [1, 2]) |
| 704 | |
| 705 | |
| 706 | def test_to_data_client_group(): |
nothing calls this directly
no test coverage detected