Skip to content

Commit

Permalink
Merge pull request KSP-CKAN#3 from pjf/cache_test
Browse files Browse the repository at this point in the history
Basic Store/Retrieve test on the new file cache.
  • Loading branch information
AlexanderDzhoganov committed Nov 8, 2014
2 parents e316bff + 8f07cac commit 655e76c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions CKAN/Tests/CKAN/Cache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,29 @@ public void RemoveCache()
{
Directory.Delete(cache_dir, true);
}

[Test]
public void StoreRetrieve()
{
Uri url = new Uri("http://example.com/");
string file = Tests.TestData.DogeCoinFlagZip();

// Sanity check, our cache dir is there, right?
Assert.IsTrue(Directory.Exists(cache.GetCachePath()));

// Our URL shouldn't be cached to begin with.
Assert.IsFalse(cache.IsCached(url));

// Store our file.
cache.Store(url, file, true);

// Now it should be cached.
Assert.IsTrue(cache.IsCached(url));

// Check contents match.
string cached_file = cache.GetCachedFilename(url);
FileAssert.AreEqual(file, cached_file);
}
/*
[Test()]
public void CacheKraken()
Expand Down

0 comments on commit 655e76c

Please sign in to comment.