def testUpdateCatalogIfChangedWhen304(self):
    self.mox.StubOutWithMock(applesus.urlfetch, 'fetch')
    self.mox.StubOutWithMock(self.c, '_UpdateCatalog')

    deadline = 30
    catalog = self.mox.CreateMockAnything()
    catalog.last_modified_header = 'lmh'
    headers = {'If-Modified-Since': catalog.last_modified_header}
    response = self.mox.CreateMockAnything()
    response.status_code = 304

    url = applesus.CATALOGS.values()[0]

    applesus.urlfetch.fetch(
        url, headers=headers, deadline=deadline,
        validate_certificate=True).AndReturn(response)

    self.mox.ReplayAll()
    self.assertFalse(self.c._UpdateCatalogIfChanged(catalog, url))
    self.mox.VerifyAll()
Test _UpdateCatalogIfChanged().
dataset/ETHPy150Open google/simian/src/tests/simian/mac/cron/applesus_test.py/AppleSUSCatalogSyncTest.testUpdateCatalogIfChangedWhen304