public void ApiUserPostTestWithRights() { string authorization = Common.AdminAuth; var userName = "******"; User item = new User(userName, userName); instance.ApiUserPost(authorization, item); Assert.IsNotNull(instance.ApiUserByNameGet(userName, authorization)); }
public void ApiScoreTopTestWithNoRights() { string userName = "******"; UserApi api = new UserApi(Common.DefaultConfig); api.ApiUserPost(Common.AdminAuth, new User(userName, userName, new List <UserRole>())); string authorization = Common.GetAuthHeader(userName, userName); string game = Common.GameName; var ex = Assert.Catch(() => instance.ApiScoreTopByGameGet(game, authorization)) as ApiException; Assert.AreEqual(Common.ForbiddenCode, ex.ErrorCode); }
public void ApiScorePostTestNormalWithNoRights() { string userName = "******"; UserApi api = new UserApi(Common.DefaultConfig); api.ApiUserPost(Common.AdminAuth, new User(userName, userName, new List <UserRole>())); string authorization = Common.GetAuthHeader(userName, userName); ScoreItem item = new ScoreItem(null, Common.GameName, null, null, 100, Common.UserName); var ex = Assert.Catch(() => instance.ApiScorePost(authorization, item)) as ApiException; Assert.AreEqual(Common.ForbiddenCode, ex.ErrorCode); }