示例#1
0
        public void ThenICanNotExecuteProtectedAdminMethodsWithInsufficientPermissions()
        {
            LogWithNewUser(Modules.VipLevelManager, Permissions.View);

            const int statusCode = (int)HttpStatusCode.Forbidden;

            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.SaveCountry(new EditCountryData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeleteCountry(new DeleteCountryData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.ActivateCulture(new ActivateCultureData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeactivateCulture(new DeactivateCultureData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.SaveCulture(new EditCultureData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.ActivateCurrency(new ActivateCurrencyData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeactivateCulture(new DeactivateCultureData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.SaveCurrency(new EditCurrencyData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.CreateUserInAdminManager(new AddAdminData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.UpdateUserInAdminManager(new EditAdminData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.ResetPasswordInAdminManager(new AddAdminData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.ActivateUserInAdminManager(new ActivateUserData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeactivateUserInAdminManager(new DeactivateUserData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetLicenseeDataInAdminManager(new GetLicenseeData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.CreateRoleInRoleManager(new AddRoleData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.UpdateRoleInRoleManager(new EditRoleData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetLicenseeDataInRoleManager(new List <Guid>())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.CreateSettingInIdentificationDocumentSettings(new IdentificationDocumentSettingsData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.UpdateSettingInIdentificationDocumentSettings(new IdentificationDocumentSettingsData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.CreateIpRegulationInAdminIpRegulations(new EditAdminIpRegulationData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.UpdateIpRegulationInAdminIpRegulations(new EditAdminIpRegulationData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeleteIpRegulationInAdminIpRegulations(new DeleteAdminIpRegulationData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.CreateIpRegulationInBrandIpRegulations(new AddBrandIpRegulationData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.UpdateIpRegulationInBrandIpRegulations(new RegoV2.Core.Common.Data.Admin.EditBrandIpRegulationData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeleteIpRegulationInBrandIpRegulations(new DeleteBrandIpRegulationData())).GetHttpCode(), Is.EqualTo(statusCode));
        }
示例#2
0
        public void ThenNewUserIsSuccessfullyCreated()
        {
            ScenarioContext.Current.Should().ContainKey("brandId");
            var brandId = ScenarioContext.Current.Get <Guid>("brandId");

            ScenarioContext.Current.Should().ContainKey("licenseeId");
            var licenseeId = ScenarioContext.Current.Get <Guid>("licenseeId");

            var data = new AddAdminData
            {
                Username          = TestDataGenerator.GetRandomString(),
                FirstName         = "User",
                LastName          = "123",
                Password          = "******",
                Language          = "English",
                IsActive          = true,
                AssignedLicensees = new[] { licenseeId },
                AllowedBrands     = new[] { brandId },
                Currencies        = new[] { "CAD" },
                RoleId            = SecurityTestHelper.CreateRole().Id
            };

            var result = AdminApiProxy.CreateUserInAdminManager(data);

            result.Should().NotBeNull();
            result.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.OK);
        }