Skip to content

Commit

Permalink
#527: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
riipah committed Nov 20, 2019
1 parent af6923a commit 491bc98
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Tests/Web/Controllers/DataAccess/UserQueriesTests.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using VocaDb.Model.Database.Queries;
Expand Down Expand Up @@ -368,6 +369,33 @@ public class UserQueriesTests {

}

[TestMethod]
public void CreateReport() {

var user = repository.Save(CreateEntry.User());

data.CreateReport(user.Id, UserReportType.Spamming, "mikumiku", "Too much negis!");

repository.List<UserReport>().Should().Contain(rep => rep.Entry.Id == user.Id && rep.User.Id == userWithEmail.Id);

}

[TestMethod]
public void CreateReport_Limited() {

var user = repository.Save(CreateEntry.User());

for (int i = 0; i < 10; ++i) {
var reporter = repository.Save(CreateEntry.User());
permissionContext.SetLoggedUser(reporter);
permissionContext.RefreshLoggedUser(repository);
data.CreateReport(user.Id, UserReportType.Spamming, "mikumiku", "Too much negis!");
}

user.GroupId.Should().Be(UserGroupId.Limited);

}

[TestMethod]
public void DisableUser() {

Expand Down

0 comments on commit 491bc98

Please sign in to comment.