def test_get_distribution_file_exists(self, mock_listener, mock_create_downloader): mock_listener.return_value.succeeded_reports = ['foo'] working_path = '/tmp/' feed = 'http://www.foo.bar/flux/' file_name = treeinfo.get_distribution_file(feed, working_path, Mock()) request = mock_create_downloader.return_value.method_calls[0][1][0][0] self.assertEquals(request.url, os.path.join(feed, constants.DISTRIBUTION_XML)) self.assertEquals(request.destination, os.path.join(working_path, constants.DISTRIBUTION_XML)) self.assertEquals(file_name, os.path.join(working_path, constants.DISTRIBUTION_XML))
def test_get_distribution_file_does_not_exists(self, mock_listener, mock_create_downloader): mock_listener.return_value.succeeded_reports = [] working_path = '/tmp/' feed = 'http://www.foo.bar/flux/' file_name = treeinfo.get_distribution_file(feed, working_path, Mock()) self.assertEquals(None, file_name)