def testGetAllPaths(self): self.bucket.Reset() # Upload some tests. self.ispy_utils.UploadExpectation('test1', [self.white, self.black]) # Check that the function gets all urls matching the prefix. self.assertEquals( set(self.ispy_utils.GetAllPaths( ispy_utils.GetExpectationPath('test1'))), set([ispy_utils.GetExpectationPath('test1', 'expected.png'), ispy_utils.GetExpectationPath('test1', 'mask.png')])) self.assertEquals( set(self.ispy_utils.GetAllPaths( ispy_utils.GetExpectationPath('test3'))), set())
def testUploadExpectation(self): self.bucket.Reset() # Upload some tests to the datastore. self.ispy_utils.UploadExpectation('test', [self.white, self.black]) self.ispy_utils.UploadExpectation('test1', [self.black, self.black]) # Confirm that the tests were successfully uploaded. self.assertEquals(self.bucket.datastore[ ispy_utils.GetExpectationPath('test', 'expected.png')], image_tools.EncodePNG(self.white)) self.assertEquals(self.bucket.datastore[ ispy_utils.GetExpectationPath('test', 'mask.png')], image_tools.EncodePNG(self.white)) self.assertEquals(self.bucket.datastore[ ispy_utils.GetExpectationPath('test1', 'expected.png')], image_tools.EncodePNG(self.black)) self.assertEquals(self.bucket.datastore[ ispy_utils.GetExpectationPath('test1', 'mask.png')], image_tools.EncodePNG(self.black))