def test_delete_folder(self): service = Service(settings.GOOGLE_P12_PATH, settings.GOOGLE_SERVICE_EMAIL) folder = service.delete_folder('test') self.assertEquals(folder['id'], 1) folder = service.delete_folder('error') self.assertIsNone(folder)
def test_add_image(self, requests_get): # Make sure if incorrect url then image is not returned. with self.assertRaises(InvalidUrlError): add_image(MagicMock(), 'test_folder', 'http://in.gogo/test.jp') service = Service(settings.GOOGLE_P12_PATH, settings.GOOGLE_SERVICE_EMAIL) image_data = add_image(service, 'test_folder', 'http://nocontenttype.com/image.jpeg') self.assertEquals( image_data, {'id': 1, 'alternateLink': 'http://a.google.com/link'}) image_data = add_image(service, 'test_folder', 'http://nocontenttype.com/error.jpg') self.assertIsNone(image_data)