'Checks that the bundle\'s cache is working, i.e. that a bundle creates only enough
ir.attachment records when rendered multiple times.'

def test_09_paginated_css_access(self):

    bundle0 = self._get_asset(self.cssbundle_xmlid, env=self.env(context={'max_css_rules': 1}))
    bundle0.css()
    self.assertEquals(len(self._any_ira_for_bundle('css')), 3)
    version0 = bundle0.version
    (ira0, ira1, ira2) = self._any_ira_for_bundle('css')
    date0 = ira0.create_date
    date1 = ira1.create_date
    date2 = ira2.create_date
    bundle1 = self._get_asset(self.cssbundle_xmlid, env=self.env(context={'max_css_rules': 1}))
    bundle1.css()
    self.assertEquals(len(self._any_ira_for_bundle('css')), 3)
    version1 = bundle1.version
    (ira3, ira4, ira5) = self._any_ira_for_bundle('css')
    date3 = ira1.create_date
    date4 = ira1.create_date
    date5 = ira1.create_date
    self.assertEquals(version0, version1)
    self.assertEquals(date0, date3)
    self.assertEquals(date1, date4)
    self.assertEquals(date2, date5)
