candlepin/candlepin — pull request #265 by jmrodri (2013-05-22 20:43:33+00:00)
Title: 959967: calculate installed prods correctly

There was a slight issue where we passed in the lastProcessed entitlement
instead of the current one when comparing validity. This caused us to mark
the previous entitlement invalid, and reset the start date in our
calculations.

I've added two new unit tests to test for the bug as well as comment the
complicated method for future devs.

TEST
-------
See the original bugzilla for testing procedures: https://bugzilla.redhat.com/show_bug.cgi?id=959967

Here is an example of the output I got before and after:

BEFORE
```
[root@dhcp231-74 ~]# subscription-manager list --installed
+-------------------------------------------+
Installed Product Status
+-------------------------------------------+
Product Name: Red Hat Enterprise Linux Server
Product ID: 69
Version: 6.3
Arch: x86_64
Status: Not Subscribed
Status Details: Not covered by a valid subscription.
Starts:
Ends:

Product Name: Multi-Attribute Limited Product
Product ID: 900
Version: 1.0
Arch: x86_64
Status: Subscribed
Status Details:
Starts: 05/09/2014
Ends: 05/09/2015
```

AFTER
```
[root@dhcp231-74 ~]# subscription-manager list --installed
+-------------------------------------------+
Installed Product Status
+-------------------------------------------+
Product Name: Red Hat Enterprise Linux Server
Product ID: 69
Version: 6.3
Arch: x86_64
Status: Not Subscribed
Status Details: Not covered by a valid subscription.
Starts:
Ends:

Product Name: Multi-Attribute Limited Product
Product ID: 900
Version: 1.0
Arch: x86_64
Status: Subscribed
Status Details:
Starts: 05/19/2013
Ends: 05/09/2015
```