public static async Task PersistedKeyPair(string xorUrl, BlsKeyPair keyPair, Keys api) { Validate.TransientKeyPair(keyPair); await Validate.XorUrlAsync(xorUrl, DataType.SafeKey, ContentType.Raw, 0); var publicKey = await api.ValidateSkForUrlAsync(keyPair.SK, xorUrl); Assert.AreEqual(keyPair.PK, publicKey); }
public async Task RemoveFromNrsMapContainerTest() { var session = await TestUtils.CreateTestApp(); var name = TestUtils.GetRandomString(5); var xorUrlResult = await CreateNrsMapContainerXorUrlAsync(session, name); var(nrsMapRaw, xorUrl, version) = await session.Nrs.RemoveFromNrsMapContainerAsync(name, DryRun); Assert.AreEqual(1, version); Assert.AreEqual("{\"sub_names_map\":{},\"default\":\"NotSet\"}", nrsMapRaw); await Validate.XorUrlAsync(xorUrl, DataType.PublishedSeqAppendOnlyData, ContentType.NrsMapContainer, 1500); }
public async Task GetNrsMapContainerTest() { var session = await TestUtils.CreateTestApp(); var name = TestUtils.GetRandomString(5); var xorUrl = await CreateNrsMapContainerXorUrlAsync(session, name); var api = session.Nrs; var(nrsMapRaw, version) = await api.GetNrsMapContainerAsync(xorUrl); Assert.AreEqual(0, version); Validate.RawNrsMap(nrsMapRaw); await Validate.XorUrlAsync(xorUrl, DataType.PublishedSeqAppendOnlyData, ContentType.NrsMapContainer, 1500); }
public async Task AddToNrsMapContainerTest() { var session = await TestUtils.CreateTestApp(); var name = TestUtils.GetRandomString(5); var xorUrlResult = await CreateNrsMapContainerXorUrlAsync(session, name); var link = await CreateFilesContainerAsync(session); var(nrsMapRaw, xorUrl, version) = await session.Nrs.AddToNrsMapContainerAsync( name, $"{link}?v=0", SetDefault, DirectLink, DryRun); Assert.AreEqual(1, version); Validate.RawNrsMap(nrsMapRaw); await Validate.XorUrlAsync(xorUrl, DataType.PublishedSeqAppendOnlyData, ContentType.NrsMapContainer, 1500); }
public async Task FilesContainerCreateAndGetTest() { var session = await TestUtils.CreateTestApp(); var(xorUrl, processedFiles, filesMap1) = await session.Files.FilesContainerCreateAsync( TestUtils.TestDataDir, null, true, false); await Validate.XorUrlAsync(xorUrl, DataType.PublishedSeqAppendOnlyData, ContentType.FilesContainer, 1100); Assert.NotNull(processedFiles.Files.Find(q => q.FileName.Equals("index.html"))); Assert.NotNull(processedFiles); Assert.NotNull(filesMap1); var(version, filesMap2) = await session.Files.FilesContainerGetAsync(xorUrl); Assert.AreEqual(0, version); }
public async Task CreateNrsMapContainerTest() { var session = await TestUtils.CreateTestApp(); var name = TestUtils.GetRandomString(5); var link = await CreateFilesContainerAsync(session); var api = session.Nrs; var(nrsMapRaw, processedEntries, xorUrl) = await api.CreateNrsMapContainerAsync( name, $"{link}?v=0", false, DryRun, SetDefault); Assert.IsNotNull(processedEntries); Validate.RawNrsMap(nrsMapRaw); await Validate.XorUrlAsync(xorUrl, DataType.PublishedSeqAppendOnlyData, ContentType.NrsMapContainer, 1500); }
public static async Task RawNrsMapAsync(string nrsMapRaw) { Assert.IsNotNull(nrsMapRaw); var nrsMap = Serialization.Deserialize <NrsMap>(nrsMapRaw); Assert.IsNull(nrsMap.SubNamesMap); /** * foreach (var entry in nrsMap.SubNamesMap.Values) * { * Assert.IsNotNull(entry.SubName); * Assert.IsNotNull(entry.SubNameRdf); * } **/ Assert.IsNotNull(nrsMap.Default); Assert.AreEqual(1, nrsMap.Default.Count); foreach (var rdf in nrsMap.Default.Values) { Assert.AreNotEqual(default(DateTime), rdf.Created); Assert.AreNotEqual(default(DateTime), rdf.Modified); Assert.IsNotNull(rdf.Link); await Validate.XorUrlAsync(rdf.Link, DataType.PublishedSeqAppendOnlyData, ContentType.FilesContainer, 1100); } }