Esempio n. 1
0
 public static string CallCommentForumList(DnaTestURLRequest request, string additionalParams)
 {
     string requestURL = "admin/commentsforumlist?s_siteid=1" + additionalParams;
     request.SetCurrentUserEditor();
     request.AssertWebRequestFailure = false;
     request.RequestSecurePage(requestURL);
     return requestURL;
 }
Esempio n. 2
0
 public static string CallCommentForumList(DnaTestURLRequest request, string sitename, string contactFormID, string additionalParams)
 {
     string requestURL = "https://" + DnaTestURLRequest.CurrentServer + "/dna/" + sitename + "/commentsforumlist/?s_siteid=1" + additionalParams;
     request.SetCurrentUserEditor();
     request.AssertWebRequestFailure = false;
     request.RequestSecurePage(requestURL);
     return requestURL;
 }
Esempio n. 3
0
 public static void SetSiteOptionForAnonymousPosting(DnaTestURLRequest request, bool allow)
 {
     request.SetCurrentUserSuperUser();
     string requestURL = "SiteOptions?siteid=1&so_1_CommentForum_AllowNotSignedInCommenting=1&sov_1_CommentForum_AllowNotSignedInCommenting=";
     requestURL += allow ? "1" : "0";
     requestURL += "&cmd=update&skin=purexml";
     request.RequestSecurePage(requestURL);
     Thread.Sleep(3000);
 }
Esempio n. 4
0
        public void TestModerateHomePageSecure()
        {
            Console.WriteLine("Before moderationhome Page Tests - TestModerateHomePageSecure");
            DnaTestURLRequest request = new DnaTestURLRequest("moderation");
            request.UseEditorAuthentication = true;
            request.SetCurrentUserEditor();  

            request.RequestSecurePage(@"moderationhome?skin=purexml");
            XmlDocument xml = request.GetLastResponseAsXML();

            Console.WriteLine("After moderationhome Page Tests - TestModerateHomePageSecure");
        }
Esempio n. 5
0
        public void TestModerateHomePageSecure()
        {
            Console.WriteLine("Before ModerateHome Page Tests - TestModerateHomePageSecure");
            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");

            Cookie cookie;
            string testUserName;
            SetupIdentityEditorUser(request, out cookie, out testUserName);

            request.RequestSecurePage(@"NModerate?skin=purexml");
            XmlDocument xml = request.GetLastResponseAsXML();

            TestUserCreator.DeleteIdentityUser(cookie, testUserName);
            request.Dispose();
            Console.WriteLine("After ModerateHome Page Tests - TestModerateHomePageSecure");
        }
Esempio n. 6
0
        public void TestSetup()
        {
            // Create the stored procedure reader for the setup
            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.UseIdentitySignIn = true;
            request.SetCurrentUserNormal();

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestingCommentBox";
            string hosturl = "http://local.bbc.co.uk/dna/haveyoursay/acs";
            string url = "acs?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // Request the page and then post a comment
            request.RequestPage(url);
            XmlDocument xml = request.GetLastResponseAsXML();
            request.RequestSecurePage("acs?dnauid=" + uid + "&dnaaction=add&dnacomment=blahblahblah&dnahostpageurl=" + hosturl + "&skin=purexml");
            XmlDocument xDoc = request.GetLastResponseAsXML();
            _entryID = Convert.ToInt32(xDoc.SelectSingleNode("//POST/@POSTID").InnerText);

            bool haveIpInfo = false;
            IInputContext context = DnaMockery.CreateDatabaseInputContext();
            using (IDnaDataReader reader = context.CreateDnaDataReader(""))
            {
                reader.ExecuteDEBUGONLY("SELECT TOP 1 EntryID FROM ThreadEntriesIpAddress WHERE entryid = " + _entryID.ToString() + " and ipaddress = '12.34.56.78' and bbcuid = '47BEB336-3409-00CF-CAD0-080020C4C7DD'");
                if (reader.Read() && reader.HasRows)
                {
                    haveIpInfo = true;
                }
            }

            // Check to see if we had the ip details added
            if (!haveIpInfo)
            {
                // No details. Insert them manualy
                using (IDnaDataReader reader = context.CreateDnaDataReader(""))
                {
                    reader.ExecuteDEBUGONLY("UPDATE ThreadEntriesIpAddress SET entryid = " + _entryID.ToString() + ", ipaddress = '12.34.56.78', bbcuid = '47BEB336-3409-00CF-CAD0-080020C4C7DD' WHERE EntryID = " + _entryID.ToString());
                    reader.Read();
                }
            }
        }
Esempio n. 7
0
        public void TestCreateNewCommentForumAndComment()
        {
            Console.WriteLine("Before CommentBoxTests - TestCreateNewCommentForumAndComment");

            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestingCommentBox";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";
            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Check to make sure that the page returned with the correct information
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag does not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/ENDDATE") == null, "End date missing when specified!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@UID='" + uid + "']") != null, "Forums uid does not matched the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@HOSTPAGEURL='" + hosturl + "']") != null, "Host url does not match the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@CANWRITE='1']") != null, "The forums can write flag should be set 1");

            // Now check to make sure we can post to the comment box
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=blahblahblah&dnahostpageurl=" + hosturl + "&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag does not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "1", "The forum should have 1 post!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST") != null, "Failed to post a comment!!!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST[TEXT='blahblahblah']") != null, "Posted comment did not appear!!!");

            Console.WriteLine("After CommentBoxTests - TestCreateNewCommentForumAndComment");
        }
Esempio n. 8
0
        public void TestBasicErrorsAndParsing()
        {
            Console.WriteLine("Before CommentBoxTests - TestBasicErrorsAndParsing");

            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestingCommentBox";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";

            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&dnainitialmodstatus=premod&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Check for parsing errors in guideml posts
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=blahblahblah2<From>NormalUser&dnahostpageurl=" + hosturl + "&dnapoststyle=1&skin=purexml");
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
            Assert.IsNotNull(xml.SelectSingleNode("//ERROR[@TYPE='XmlParseError']"), "Failed to find the XMLError error");
            Assert.AreEqual("blahblahblah2%3CFrom%3ENormalUser", xml.SelectSingleNode("//ORIGINALPOSTTEXT").InnerText, "The original text should be 'blahblahblah2%C3From%3ENormalUser'");

            // Check for correct handling for profanities
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=blahblah1blah3NormalUser f**k&dnahostpageurl=" + hosturl + "&poststyle=1&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
            Assert.IsNotNull(xml.SelectSingleNode("//ERROR[@TYPE='profanityblocked']"), "Failed to find the Profanity Blocked error");
            Assert.AreEqual("blahblah1blah3NormalUser%20fuck", xml.SelectSingleNode("//ORIGINALPOSTTEXT").InnerText, "The original text should be 'blahblah1blah3NormalUser%20fuck'");

            Console.WriteLine("After CommentBoxTests - TestBasicErrorsAndParsing");
        }
Esempio n. 9
0
        public void TestModerateHomePageUnlockAll()
        {
            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            Cookie cookie;
            string testUserName;
            SetupIdentityEditorUser(request, out cookie, out testUserName);
/*
            modHomeParams.UnlockForums = InputContext.DoesParamExist("UnlockForums", _docDnaUnlockForums);
            modHomeParams.UnlockForumReferrals = InputContext.DoesParamExist("UnlockForumReferrals", _docDnaUnlockForumReferrals);
            modHomeParams.UnlockUserPosts = InputContext.DoesParamExist("UnlockUserPosts", _docDnaUnlockUserPosts);
            modHomeParams.UnlockSitePosts = InputContext.DoesParamExist("UnlockSitePosts", _docDnaUnlockSitePosts);
            modHomeParams.UnlockAllPosts = InputContext.DoesParamExist("UnlockAllPosts", _docDnaUnlockAllPosts);
            modHomeParams.UnlockArticles = InputContext.DoesParamExist("UnlockArticles", _docDnaUnlockArticles);
            modHomeParams.UnlockArticleReferrals = InputContext.DoesParamExist("UnlockArticleReferrals", _docDnaUnlockArticleReferrals);
            modHomeParams.UnlockGeneral = InputContext.DoesParamExist("UnlockGeneral", _docDnaUnlockGeneral);
            modHomeParams.UnlockGeneralReferrals = InputContext.DoesParamExist("UnlockGeneralReferrals", _docDnaUnlockGeneralReferrals);
            modHomeParams.UnlockNicknames = InputContext.DoesParamExist("UnlockNicknames", _docDnaUnlockNicknames);
            modHomeParams.UnlockAll = InputContext.DoesParamExist("UnlockAll", _docDnaUnlockAll);
*/
            request.RequestSecurePage(@"NModerate?UnlockForums=1&skin=purexml");
            request.RequestSecurePage(@"NModerate?UnlockForumReferrals=1&skin=purexml");
            request.RequestSecurePage(@"NModerate?UnlockUserPosts=1&skin=purexml");
            request.RequestSecurePage(@"NModerate?UnlockSitePosts=1&skin=purexml");
            request.RequestSecurePage(@"NModerate?UnlockAllPosts=1&skin=purexml");
            request.RequestSecurePage(@"NModerate?UnlockArticles=1&skin=purexml");
            request.RequestSecurePage(@"NModerate?UnlockArticleReferrals=1&skin=purexml");
            request.RequestSecurePage(@"NModerate?UnlockGeneral=1&skin=purexml");
            request.RequestSecurePage(@"NModerate?UnlockGeneralReferrals=1&skin=purexml");
            request.RequestSecurePage(@"NModerate?UnlockNicknames=1&skin=purexml");
            request.RequestSecurePage(@"NModerate?UnlockAll=1&skin=purexml");

            XmlDocument xml = request.GetLastResponseAsXML();

            TestUserCreator.DeleteIdentityUser(cookie, testUserName);
            request.Dispose();
        }
        public void Test5CheckThatCanWriteFlagGetSetAccordinglyInRespectToForumClosingDate()
        {
            // Create a new comment box with no closing date
            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            // Setup the request url
            string forumClosingDate = DateTime.Today.AddDays(10).Year.ToString();
            if (DateTime.Today.AddDays(10).Month.ToString().Length == 1)
            {
                forumClosingDate += "0";
            }
            forumClosingDate += DateTime.Today.AddDays(10).Month.ToString();
            if (DateTime.Today.AddDays(10).Day.ToString().Length == 1)
            {
                forumClosingDate += "0";
            }
            forumClosingDate += DateTime.Today.AddDays(10).Day.ToString();

            string uid = Guid.NewGuid().ToString();
            string title = "Testing";
            string hosturl = "http://local.bbc.co.uk/dna/haveyoursay/acs";
            string url = "acs?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumclosedate=" + forumClosingDate + "&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Check to make sure that the page returned with the correct information
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.OuterXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag does not exist!");
            XmlNode date = xml.SelectSingleNode("/H2G2/COMMENTBOX/ENDDATE/DATE/LOCAL");
            Assert.IsTrue(date != null, "End date missing when specified!");
            Assert.AreEqual(DateTime.Today.AddDays(10 + 1).ToString("MM"), date.Attributes["MONTH"].Value);
            Assert.AreEqual(DateTime.Today.AddDays(10 + 1).ToString("dd"), date.Attributes["DAY"].Value);
            Assert.AreEqual(DateTime.Today.AddDays(10 + 1).ToString("yyyy"), date.Attributes["YEAR"].Value);

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@UID='" + uid + "']") != null, "Forums uid does not matched the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@HOSTPAGEURL='" + hosturl + "']") != null, "Host url does not match the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@CANWRITE='1']") != null, "The forums can write flag should be set 1");

            // Now ste the closing date of the forum to something in the past.
            using (IDnaDataReader dataReader = _context.CreateDnaDataReader("updatecommentforumstatus"))
            {
                dataReader.AddParameter("uid", uid);
                dataReader.AddParameter("forumclosedate", DateTime.Today.AddDays(-20));
                dataReader.Execute();
            }

            // now get the response
            request.RequestPage("acs?dnauid=" + uid + "&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.OuterXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag does not exist!");
            date = xml.SelectSingleNode("/H2G2/COMMENTBOX/ENDDATE/DATE/LOCAL");
            Assert.IsTrue(date != null, "End date missing when specified!");
            Assert.AreEqual(DateTime.Today.AddDays(-20).ToString("MM"), date.Attributes["MONTH"].Value);
            Assert.AreEqual(DateTime.Today.AddDays(-20).ToString("dd"), date.Attributes["DAY"].Value);
            Assert.AreEqual(DateTime.Today.AddDays(-20).ToString("yyyy"), date.Attributes["YEAR"].Value);

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@UID='" + uid + "']") != null, "Forums uid does not matched the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@HOSTPAGEURL='" + hosturl + "']") != null, "Host url does not match the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@CANWRITE='0']") != null, "The forums can write flag should be set 0");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "0", "The forum not have any posts!");

            // Now make sure the user can't post to a closed forum
            request.RequestSecurePage("acs?dnauid=" + uid + "&dnaaction=add&dnacomment=blahblahblah&dnahostpageurl=" + hosturl + "&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.OuterXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag does not exist!");
            date = xml.SelectSingleNode("/H2G2/COMMENTBOX/ENDDATE/DATE/LOCAL");
            Assert.IsTrue(date != null, "End date missing when specified!");
            Assert.AreEqual(DateTime.Today.AddDays(-20).ToString("MM"), date.Attributes["MONTH"].Value);
            Assert.AreEqual(DateTime.Today.AddDays(-20).ToString("dd"), date.Attributes["DAY"].Value);
            Assert.AreEqual(DateTime.Today.AddDays(-20).ToString("yyyy"), date.Attributes["YEAR"].Value);

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@UID='" + uid + "']") != null, "Forums uid does not matched the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@HOSTPAGEURL='" + hosturl + "']") != null, "Host url does not match the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@CANWRITE='0']") != null, "The forums can write flag should be set 0");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "0", "The forum not have any posts!");

            // Now make sure Editors can post to a closed forum
            request.SetCurrentUserEditor();
            request.RequestSecurePage("acs?dnauid=" + uid + "&dnaaction=add&dnacomment=blahblahblah&dnahostpageurl=" + hosturl + "&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.OuterXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag does not exist!");
            date = xml.SelectSingleNode("/H2G2/COMMENTBOX/ENDDATE/DATE/LOCAL");
            Assert.IsTrue(date != null, "End date missing when specified!");
            Assert.AreEqual(DateTime.Today.AddDays(-20).ToString("MM"), date.Attributes["MONTH"].Value);
            Assert.AreEqual(DateTime.Today.AddDays(-20).ToString("dd"), date.Attributes["DAY"].Value);
            Assert.AreEqual(DateTime.Today.AddDays(-20).ToString("yyyy"), date.Attributes["YEAR"].Value);

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@UID='" + uid + "']") != null, "Forums uid does not matched the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@HOSTPAGEURL='" + hosturl + "']") != null, "Host url does not match the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@CANWRITE='0']") != null, "The forums can write flag should be set 0 even fopr the editor! This is due to the fact that the forum gets put into html caching mode.");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "1", "The forum should have 1 post!");

            // Added extra test for making sure that a normal user cannot post to a forum that has closed
        }
Esempio n. 11
0
        public void TestCommentWithALinkWithCRLFInItPostStyle1()
        {
            Console.WriteLine("Before CommentBoxTests - TestCommentWithALinkWithCRLFInItPostStyle1");

            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestingCommentBox";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";

            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Check to make sure that the page returned with the correct information
            XmlDocument xml = request.GetLastResponseAsXML();

            string dodgyLink = @"<a <href=""" + "\r\n" + @""">Test Link</a>";
            // Now check to make sure we can post to the comment box
            request.RequestSecurePage("acswithoutapi?skin=purexml&dnapoststyle=1&dnauid=" + uid + "&dnaaction=add&dnacomment=blahblahblah" + dodgyLink + "&dnahostpageurl=" + hosturl);

            // Check to make sure that the page returned with the correct information
            xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
            //<ERROR TYPE="XmlParseError">
            //<ERRORMESSAGE>The comment contains invalid xml.</ERRORMESSAGE> 
            //</ERROR>

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/ERROR[@TYPE='XmlParseError']") != null, "Error not created.");

            Console.WriteLine("After CommentBoxTests -  TestCommentWithALinkWithCRLFInItPostStyle1");
        }
Esempio n. 12
0
        public void TestCommentWithALinkWithCRLFInIt()
        {
            Console.WriteLine("Before CommentBoxTests - TestCommentWithALinkWithCRLFInIt");

            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestingCommentBox";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";

            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Check to make sure that the page returned with the correct information
            XmlDocument xml = request.GetLastResponseAsXML();

            //string dodgyLink = @"<a href='#" + "\r\n" + @"'>Test Link</a>";
            string dodgyLink = @"<a href=""http:" + "%0D%0A" + @""">Test Link</a>";
            // Now check to make sure we can post to the comment box
            request.RequestSecurePage("acswithoutapi?skin=purexml&dnauid=" + uid + "&dnaaction=add&dnacomment=blahblahblah" + dodgyLink + "&dnahostpageurl=" + hosturl);

            // Check to make sure that the page returned with the correct information
            xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST/TEXT").InnerText == "blahblahblah<a href=\"http:\">Test Link</a>", "Post was created with the comment cut off.");

            Console.WriteLine("After CommentBoxTests -  TestCommentWithALinkWithCRLFInIt");
        }
Esempio n. 13
0
        public void TestCommentWithDodgyCharInIt()
        {
            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            Console.WriteLine("Before CommentBoxTests - TestCommentWithDodgyCharInIt");

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestingCommentBox";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";

            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Check to make sure that the page returned with the correct information
            XmlDocument xml = request.GetLastResponseAsXML();

            // Now check to make sure we can post to the comment box
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=Test<character&dnahostpageurl=" + hosturl + "&skin=purexml");

            // Check to make sure that the page returned with the correct information
            xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST/TEXT").InnerText == "Test<character", "Post was created with the comment marked up.");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST/TEXT").InnerXml == "Test&lt;character", "Post was created with the comment marked up.");

            Console.WriteLine("After CommentBoxTests -  TestCommentWithDodgyCharInIt");
        }
Esempio n. 14
0
        public void TestCreateCommentSiteError()
        {
            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestCreateCommentWithChangeSite";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";

            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Now change site
            request = new DnaTestURLRequest("h2g2");
            request.SetCurrentUserNormal();

            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=TestCreateCommentWithChangeSite&dnahostpageurl=" + hosturl + "&skin=purexml");
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/ERROR[@TYPE='commentfailed-invalidsite']") != null,"Error not created." );
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "0", "Comment appears to have been created from a different site.");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST") == null, "Post was created where it was not expected.");
          
        }
Esempio n. 15
0
        public void TestCreateNewCommentForumAndCommentOnEmergencyClosedSite()
        {
            Console.WriteLine("Before CommentBoxTests - TestCreateNewCommentForumAndCommentOnEmergencyClosedSite");
            _doOpenSite = true;

            // Start by emergency closing the site.
            Assert.IsTrue(SetSiteEmergencyClosed(true), "Failed to close the site in a timely fashion!!!");

            DnaTestURLRequest request = new DnaTestURLRequest("h2g2");
            
            //request.SetCurrentUserEditor();
            //request.UseEditorAuthentication = true;
            //request.RequestPage("messageboardschedule?action=closesite&confirm=1&skin=purexml");
            //XmlDocument xml = request.GetLastResponseAsXML();
            //Assert.AreEqual(xml.SelectSingleNode("/H2G2/SITE-CLOSED").InnerXml, "1", "The haveyoursay site was not closed correctly! Please check your database!");

            //// Now wait untill the .net has been signaled by ripley that we need to recache site data. Emergency closed is in the data!!!
            //// Make sure we've got a drop clause after 15 seconds!!!
            //DateTime time = DateTime.Now.AddSeconds(30);
            //bool siteIsClosed = false;
            //while (!siteIsClosed && time > DateTime.Now)
            //{
            //    request.RequestPage("acswithoutapi?skin=purexml");
            //    if (request.GetLastResponseAsXML().SelectSingleNode("//SITE/SITECLOSED") != null)
            //    {
            //        siteIsClosed = request.GetLastResponseAsXML().SelectSingleNode("//SITE/SITECLOSED").InnerXml.CompareTo("1") == 0;
            //    }
            //}

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestingCommentBox";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";

            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.SetCurrentUserNormal();
            request.UseEditorAuthentication = false;
            request.RequestPage(url);

            // Check to make sure that the page returned with the correct information
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag doers not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/ENDDATE") == null, "End date missing when specified!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@UID='" + uid + "']") != null, "Forums uid does not matched the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@HOSTPAGEURL='" + hosturl + "']") != null, "Host url does not match the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@CANWRITE='0']") != null, "The forums can write flag should be set 0");
            Assert.IsTrue(xml.SelectSingleNode("//SITE[SITECLOSED='1']") != null, "haveyoursay site is not closed when we set the test to close it.");

            // Now check to make sure that a normal users post gets premoderated
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=blahblahblahFromNormalUser&dnahostpageurl=" + hosturl + "&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag doers not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "0", "The forum should have 1 post!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST") == null, "Normal user should not be able to post to a closed site!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@CANWRITE='0']") != null, "The forums can write flag should be set 0");
            Assert.IsTrue(xml.SelectSingleNode("//SITE[SITECLOSED='1']") != null, "haveyoursay site is not closed when we set the test to close it.");

            // Now check to make sure that a notable can post a comment without being moderated
            request.SetCurrentUserNotableUser();
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=blahblahblahFromNotableUser&dnahostpageurl=" + hosturl + "&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "0", "The forum should have 1 post!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST") == null, "Notable user should not be able to post to a closed site!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@CANWRITE='0']") != null, "The forums can write flag should be set 0");
            Assert.IsTrue(xml.SelectSingleNode("//SITE[SITECLOSED='1']") != null, "haveyoursay site is not closed when we set the test to close it.");

            // Now check to make sure that a editor can post a comment without being moderated
            request.SetCurrentUserEditor();
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=blahblahblahFromEditor&dnahostpageurl=" + hosturl + "&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag doers not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "1", "The forum should have 1 post!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST[TEXT='blahblahblahFromEditor']") != null, "Posted comment did not appear for editor!!!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@CANWRITE='0']") != null, "The forums can write flag should be set 0 even for editors as the forum is cached as if a normal user is viewing the page when closed");
            Assert.IsTrue(xml.SelectSingleNode("//SITE[SITECLOSED='1']") != null, "haveyoursay site is not closed when we set the test to close it.");


            SetSiteEmergencyClosed(false);
            Console.WriteLine("After CommentBoxTests - TestCreateNewCommentForumAndCommentOnEmergencyClosedSite");
        }
Esempio n. 16
0
        public void TestCreateNewPreModCommentForumAndUnicodeComment()
        {
            Console.WriteLine("Before CommentBoxTests - TestCreateNewPreModCommentForumAndUnicodeComment");

            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string encodedTitle = "\u041D\u0435 \u043F\u0430\u043D\u0438\u043A\u0443\u0439\u0442\u0435";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";

            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + encodedTitle + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&dnainitialmodstatus=premod&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Check to make sure that the page returned with the correct information
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag does not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@UID='" + uid + "']") != null, "Forums uid does not matched the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@HOSTPAGEURL='" + hosturl + "']") != null, "Host url does not match the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@CANWRITE='1']") != null, "The forums can write flag should be set 1");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@MODERATIONSTATUS='3']") != null, "The forums moderation status should be 3 (premod)");

            // Now check to make sure that a normal users post gets premoderated
            string comment = "\u03CC\u03C7\u03B9 \u03C0\u03B1\u03BD\u03B9\u03BA\u03CC\u03C2 FromNormalUser" + uid;
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=" + comment + "&dnahostpageurl=" + hosturl + "&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag does not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "1", "The forum should have 1 post!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST") != null, "Failed to create new comment");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST[@HIDDEN='3']") != null, "Failed to create new comment with hidden status 3");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST[SUBJECT='Hidden']") != null, "Failed to create new comment with hidden subject");

            // Now check to make sure that a notable can post a comment without being moderated
            request.SetCurrentUserNotableUser();
            string notableComment = "\u03CC\u03C7\u03B9 \u03C0\u03B1\u03BD\u03B9\u03BA\u03CC\u03C2 FromNotable" + uid;
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=" + notableComment + "&dnahostpageurl=" + hosturl + "&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag doers not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "2", "The forum should have 2 post!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST[TEXT='" + notableComment + "']") != null, "Posted comment did not appear for notable!!!");

            // Now check to make sure that a editor can post a comment without being moderated
            request.SetCurrentUserEditor();
            string editorComment = "\u03CC\u03C7\u03B9 \u03C0\u03B1\u03BD\u03B9\u03BA\u03CC\u03C2 FromEditor" + uid;
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=" + editorComment + "&dnahostpageurl=" + hosturl + "&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag doers not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "3", "The forum should have 3 post!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST[TEXT='" + editorComment + "']") != null, "Posted comment did not appear for editor!!!");

            Console.WriteLine("After CommentBoxTests - TestCreateNewPreModCommentForumAndUnicodeComment");
        }
Esempio n. 17
0
        public void TestCreateNewUnicodeCommentComplain()
        {
            Console.WriteLine("Before CommentBoxTests - TestCreateNewUnicodeCommentComplain");

            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string encodedTitle = "TestCreateNewUnicodeCommentComplain - \u041D\u0435 \u043F\u0430\u043D\u0438\u043A\u0443\u0439\u0442\u0435";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";
            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + encodedTitle + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Check to make sure that the page returned with the correct information
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag does not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@UID='" + uid + "']") != null, "Forums uid does not matched the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@HOSTPAGEURL='" + hosturl + "']") != null, "Host url does not match the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@CANWRITE='1']") != null, "The forums can write flag should be set 1");

            string comment = "ComplainAboutThis\u4E0D\u8981\u6050\u614C works too now as well as well as \u041D\u0435 \u043F\u0430\u043D\u0438\u043A\u0443\u0439\u0442\u0435 \u00A3 \u0024 \u0025";

            // Now check to make sure we can post to the comment box
            //The unicode string just goes in as it is to come out not sure this will fully test how the string will come from the skins
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=" + comment + "&dnahostpageurl=" + hosturl + "&skin=purexml");            
            
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag does not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "1", "The forum should have 1 post!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST") != null, "Failed to post a comment!!!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST[TEXT='" + comment + "']") != null, "Posted comment did not appear!!!");

            string postID = xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST").Attributes["POSTID"].Value;

            //COMPLAIN ABOUT IT
            //request.SetCurrentUserNotLoggedInUser();
            request.RequestPage("UserComplaintPage?postid=" + postID + "&action=submit&complaintreason=libellous&complainttext=Complaint&[email protected]&skin=purexml");
            xml = request.GetLastResponseAsXML();

            // Check to make sure complaint was processed
            Assert.IsTrue(xml.SelectSingleNode("//H2G2/USERCOMPLAINT/@MODID") != null, "Complaint did not succeed");

            //PUT the moderator into a moderation class
            IInputContext context = DnaMockery.CreateDatabaseInputContext();
            using (IDnaDataReader reader = context.CreateDnaDataReader(""))
            {
                reader.ExecuteDEBUGONLY("insert into moderationclassmembers (ModClassID, UserID) values (1, 1090564231)");
            }

            request.SetCurrentUserModerator();
            request.UseEditorAuthentication = true;
            request.RequestPage("moderateposts?modclassid=1&s_classview=1&alerts=1&fastmod=0&notfastmod=0&skin=purexml");

            xml = request.GetLastResponseAsXML();
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/POSTMODERATION/POST[TEXT='" + comment + "']") != null, "Complained about comment did not appear correctly!!!");

            Console.WriteLine("After CommentBoxTests - TestCreateNewUnicodeCommentComplain");
        }
Esempio n. 18
0
        public void TestAjaxRichTextPosts_PostTwice_ReturnsLatestCommentOnly()
        {
            Console.WriteLine("Before CommentBoxTests - TestRichTextPosts");

            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestingCommentBox";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";

            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&dnainitialmodstatus=reactive&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Add a comment to the list
            // DO NOT REFORMAT THE FOLLOWING TEST AS IT CONTAINS /r/n AS INTENDED!!!
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + @"&dnaaction=add&dnacomment=blahblahblah2<b>NormalUser</b>
with a carrage return.&dnahostpageurl=" + hosturl + "&dnapoststyle=1&skin=purexml");
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.AreEqual(@"blahblahblah2<b>NormalUser</b><BR />with a carrage return.", xml.SelectSingleNode("//RICHPOST").InnerXml, "The rich post did not come back with the expected formatting.");

            //post again - check for latest comment only
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + @"&dnaaction=add&dnacomment=blahblahblah3<b>NormalUser</b>
with a carrage return.&dnahostpageurl=" + hosturl + "&dnapoststyle=1&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            var posts = xml.SelectNodes("//H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST");
            Assert.AreEqual(2, posts.Count);
            Assert.IsTrue(Int32.Parse(posts[0].Attributes["POSTID"].Value) > Int32.Parse(posts[1].Attributes["POSTID"].Value));
            Assert.AreEqual(@"blahblahblah3<b>NormalUser</b><BR />with a carrage return.", xml.SelectSingleNode("//RICHPOST").InnerXml, "The rich post did not come back with the expected formatting.");

            Console.WriteLine("After CommentBoxTests - TestRichTextPosts");
        }
Esempio n. 19
0
        public void TestCreateCommentForumWithUnicodeTitleAndThenMoveIt_ReturnsMovedThread()
        {
            Console.WriteLine("Before MoveThreadTests - TestCreateCommentForumWithUnicodeTitleAndThenMoveIt");

            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.UseIdentitySignIn = true;
            request.UseEditorAuthentication = true;
            request.SetCurrentUserEditor();
            //request.SignUserIntoSSOViaWebRequest(DnaTestURLRequest.usertype.EDITOR);
            //request.SignUserIntoSSOViaProfileAPI(DnaTestURLRequest.usertype.EDITOR);

            string server = DnaTestURLRequest.CurrentServer;

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string encodedTitle = "\u041D\u0435 \u043F\u0430\u043D\u0438\u043A\u0443\u0439\u0442\u0435 1st Forums Title";
            string hosturl = "http://" + server + "/dna/haveyoursay/acs";

            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + encodedTitle + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.RequestPage(url);
            XmlDocument xml = request.GetLastResponseAsXML();

            string comment = "\u03CC\u03C7\u03B9 \u03C0\u03B1\u03BD\u03B9\u03BA\u03CC\u03C2 1st Comment " + uid;
            // Now check to make sure we can post to the comment box
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=" + comment + "&dnahostpageurl=" + hosturl + "&skin=purexml");
            // Check to make sure that the page returned with the correct information
            xml = request.GetLastResponseAsXML();
            int forumID = 0;
            Int32.TryParse(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMID"].Value, out forumID);

            int threadid = 0;
            Int32.TryParse(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST").Attributes["THREAD"].Value, out threadid);



            // Setup the 2nd comment forum
            string uid2 = Guid.NewGuid().ToString();
            string encodedTitle2 = "\u041D\u0435 \u043F\u0430\u043D\u0438\u043A\u0443\u0439\u0442\u0435 2nd Forums Title";
            string hosturl2 = "http://" + server + "/dna/haveyoursay/acs";

            string url2 = "acswithoutapi?dnauid=" + uid2 + "&dnainitialtitle=" + encodedTitle2 + "&dnahostpageurl=" + hosturl2 + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.RequestPage(url2);
            XmlDocument xml2 = request.GetLastResponseAsXML();

            //string comment2 = "\u03CC\u03C7\u03B9 \u03C0\u03B1\u03BD\u03B9\u03BA\u03CC\u03C2" + uid2;
            // Now check to make sure we can post to the comment box
            // request.RequestPage("acswithoutapi?dnauid=" + uid2 + "&dnaaction=add&dnacomment=" + comment2 + "&dnahostpageurl=" + hosturl2 + "&skin=purexml");
            // Check to make sure that the page returned with the correct information
            //xml = request.GetLastResponseAsXML();
            int forumID2 = 0;
            Int32.TryParse(xml2.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMID"].Value, out forumID2);

            // Create a database context
            IInputContext context = DnaMockery.CreateDatabaseInputContext();

            // Mock the viewing user
            IUser mockedUser = DnaMockery.CurrentMockery.NewMock<IUser>();
            Stub.On(mockedUser).GetProperty("IsEditor").Will(Return.Value(true));
            Stub.On(mockedUser).GetProperty("IsModerator").Will(Return.Value(false));
            Stub.On(context).GetProperty("ViewingUser").Will(Return.Value(mockedUser));

            // Mock the current site
            ISite mockedSite = DnaMockery.CurrentMockery.NewMock<ISite>();
            Stub.On(mockedSite).GetProperty("SiteID").Will(Return.Value(72));
            Stub.On(mockedSite).GetProperty("AutoMessageUserID").Will(Return.Value(1090558354));

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml("<TOPIC-LIST />");
            Stub.On(mockedSite).Method("GetTopicListXml").Will(Return.Value(xmlDoc.FirstChild));
            Stub.On(context).GetProperty("CurrentSite").Will(Return.Value(mockedSite));

            // Use the move thread builder to get the details for the thread
            Stub.On(context).Method("GetParamIntOrZero").With("ThreadModID", "Get the ThreadModID").Will(Return.Value(0));
            Stub.On(context).Method("GetParamIntOrZero").With("ThreadID", "Get the thread to move").Will(Return.Value(threadid));
            Stub.On(context).Method("GetParamCountOrZero").With("Move", "Do we have a move param").Will(Return.Value(1));
            Stub.On(context).Method("GetParamIntOrZero").With("MoveToForumID", "Get the move to forum id").Will(Return.Value(forumID2));
            Stub.On(context).Method("DoesParamExist").With("PostContent", "Do we have post content").Will(Return.Value(false));
            MoveThread testMoveThread = new MoveThread(context);
            testMoveThread.ProcessRequest();

            //get the second url again and it should contain the first urls post
            request.RequestPage(url2);
            xml = request.GetLastResponseAsXML();
            bool movedText = xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST[TEXT='" + comment + "']") != null;

            Assert.IsTrue(movedText, "Post to the 1st Forum has not been moved to the second" + xml.InnerText);

            Console.WriteLine("After MoveThreadTests - TestCreateCommentForumWithUnicodeTitleAndThenMoveIt");

        }
Esempio n. 20
0
        public void TestRichTextPostsCRLFInLink()
        {
            Console.WriteLine("Before CommentBoxTests - TestRichTextPostsCRLFInLink");

            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestingCommentBox";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";

            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&dnainitialmodstatus=reactive&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Add a comment to the list
            // DO NOT REFORMAT THE FOLLOWING TEST AS IT CONTAINS /r/n AS INTENDED!!!
            url = "acswithoutapi?dnauid=" + uid + @"&dnaaction=add&dnacomment=blahblahblah2<b>NormalUser</b><a href=""
www.bbc.co.uk/dna/h2g2"">fail you bugger</a>with a carrage
return.&dnahostpageurl=" + hosturl + "&dnapoststyle=1&skin=purexml";
            request.RequestSecurePage(url);
            XmlDocument xml = request.GetLastResponseAsXML();

            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.AreEqual(@"blahblahblah2<b>NormalUser</b><a href="" www.bbc.co.uk/dna/h2g2"">fail you bugger</a>with a carrage<BR />return.", xml.SelectSingleNode("//RICHPOST").InnerXml, "The rich post did not come back with the expected formatting.");

            Console.WriteLine("After CommentBoxTests - TestRichTextPostsCRLFInLink");
        }
        public void TermsFilterAdminPage_CreateGreekTermRefreshSitePostViaAcs_CorrectlyBlocksContent()
        {
            const int modClassId = 3;
            var request = new DnaTestURLRequest(SiteName) { UseEditorAuthentication = true };
            request.SetCurrentUserSuperUser();
            request.RequestPage(string.Format("termsfilteradmin?modclassid={0}&skin=purexml&ignorecache=1", modClassId));
            ValidateResponse(request);

            var doc = request.GetLastResponseAsXML();
            var termNode = doc.SelectSingleNode("//H2G2/TERMSFILTERADMIN/TERMSLIST/TERMDETAILS");
            var termNodeCount = doc.SelectNodes("//H2G2/TERMSFILTERADMIN/TERMSLIST/TERMDETAILS").Count;
            request.RequestPage(string.Format("termsfilteradmin?modclassid={0}&skin=purexml", modClassId));
            var termText = "πρόσωπο";
            TermAction expectedAction = TermAction.ReEdit;

            var postParams = new Queue<KeyValuePair<string, string>>();
            postParams.Enqueue(new KeyValuePair<string, string>("termtext", termText));
            postParams.Enqueue(new KeyValuePair<string, string>("termaction", expectedAction.ToString()));

            //update the first term
            request.RequestPage(string.Format("termsfilteradmin?modclassid={0}&action=UPDATETERM&skin=purexml", modClassId),
                postParams);

            ValidateResponse(request);
            ValidateOkResult(request, "TermsUpdateSuccess", "Terms updated successfully.");
            doc = request.GetLastResponseAsXML();
            termNode = doc.SelectSingleNode("//H2G2/TERMSFILTERADMIN/TERMSLIST/TERMDETAILS[@TERM='" + termText + "']");
            Assert.AreEqual(expectedAction.ToString(), termNode.Attributes["ACTION"].Value);
            Assert.AreEqual(termText, termNode.Attributes["TERM"].Value);
            Assert.AreEqual(termNodeCount + 1, doc.SelectNodes("//H2G2/TERMSFILTERADMIN/TERMSLIST/TERMDETAILS").Count);

            //check history audit
            var terms = new List<Term>();
            terms.Add(new Term { Id = Int32.Parse(termNode.Attributes["ID"].Value), Action = expectedAction });
            CheckAuditTable(modClassId, terms);

            //Do siterefresh
            request.RequestPage("termsfilteradmin?action=REFRESHCACHE");

            // Setup the request url
            var url = String.Format("acs?dnauid={0}&dnahostpageurl={1}&dnainitialtitle={2}&dnaur=0&skin=purexml", 
                Guid.NewGuid(), "http://www.bbc.co.uk/dna/h2g2/test.aspx", "test forum");
            // now get the response
            request = new DnaTestURLRequest("h2g2");
            request.SetCurrentUserNormal();
            request.RequestPage(url);//create forum
            doc = request.GetLastResponseAsXML();
            Assert.IsNull(doc.SelectSingleNode("//H2G2/ERROR"));

            url += "&dnaaction=add";
            postParams = new Queue<KeyValuePair<string, string>>();
            postParams.Enqueue(new KeyValuePair<string, string>("dnacomment", termText));
            request.RequestSecurePage(url, postParams);
            ValidateError(request, "profanityblocked", termText);


        }
Esempio n. 22
0
        public void TestCreateCommentForumAndThenChangeTitle()
        {
            Console.WriteLine("Before CommentBoxTests - TestCreateCommentForumAndThenChangeTitle");

            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.UseEditorAuthentication = true;
            request.UseIdentitySignIn = true;
            request.SetCurrentUserEditor();
            //request.SignUserIntoSSOViaWebRequest(DnaTestURLRequest.usertype.EDITOR);

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestingCommentBox";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";

            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.RequestPage(url);
            XmlDocument xml = request.GetLastResponseAsXML();

            // Now check to make sure we can post to the comment box
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=blahblahblah&dnahostpageurl=" + hosturl + "&skin=purexml");
            // Check to make sure that the page returned with the correct information
            xml = request.GetLastResponseAsXML();

            string newtitle = "TestingCommentBoxChangesTitle";
            url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + newtitle + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";
            request.RequestPage(url);
            // now get the response
            xml = request.GetLastResponseAsXML();
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST/COMMENTFORUMTITLE").InnerText == "TestingCommentBoxChangesTitle", "Forum Title has not been changed.");
            
            request.RequestPage("CommentForumList?dnaskip=0&dnashow=100&skin=purexml");
            // Check to make sure that the page returned with the correct information
            xml = request.GetLastResponseAsXML();

            Assert.IsTrue(xml.SelectSingleNode("H2G2/COMMENTFORUMLIST/COMMENTFORUM[@UID='" + uid + "']/TITLE").InnerText == "TestingCommentBoxChangesTitle", "The comment forum list page has not been generated correctly - COMMENTFORUMLISTTITLE!!!");
        }
Esempio n. 23
0
        /// <summary>
        /// Tests the comments error messages for given comments
        /// </summary>
        /// <param name="comment">The comment you want to test against</param>
        /// <param name="expectedMessage">The expected error message</param>
        private void TestCommentRequestErrorMessage(string uid, string comment, string expectedMessage)
        {
            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();
            request.AllowAutoRedirect = true;
            // Setup the request url
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";

            string encodedComment = HttpUtility.UrlEncode(comment);
            string url = "acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=" + encodedComment + "&dnahostpageurl=" + hosturl + "&dnapoststyle=1&dnaur=1&skin=purexml";
            request.RequestSecurePage(url);
            
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.AreEqual(expectedMessage, xml.SelectSingleNode("//ERRORMESSAGE").InnerXml, "Incorrect error message given.");
        }
Esempio n. 24
0
        public void TestCreateNewCommentForumAndCommentWithAUnicodeComment()
        {
            Console.WriteLine("Before CommentBoxTests - TestCreateNewCommentForumAndCommentWithAUnicodeComment");

            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestingCommentBoxUnicode";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";
            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Check to make sure that the page returned with the correct information
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag does not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@UID='" + uid + "']") != null, "Forums uid does not matched the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@HOSTPAGEURL='" + hosturl + "']") != null, "Host url does not match the one used to create!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS[@CANWRITE='1']") != null, "The forums can write flag should be set 1");

            string comment = "\u4E0D\u8981\u6050\u614C works too now as well as well as \u041D\u0435 \u043F\u0430\u043D\u0438\u043A\u0443\u0439\u0442\u0435 \u00A3 \u0024 \u0025";

            // Now check to make sure we can post to the comment box
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=&dnahostpageurl=" + hosturl + "&skin=purexml");
            
            //The unicode string just goes in as it is to come out not sure this will fully test how the string will come from the skins
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=" + comment + "&dnahostpageurl=" + hosturl + "&skin=purexml");
            xml = request.GetLastResponseAsXML();
            validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX") != null, "Comment box tag does not exist!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS").Attributes["FORUMPOSTCOUNT"].Value == "1", "The forum should have 1 post!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST") != null, "Failed to post a comment!!!");
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST[TEXT='" + comment + "']") != null, "Posted comment did not appear!!!");

            Console.WriteLine("After CommentBoxTests - TestCreateNewCommentForumAndCommentWithAUnicodeComment");
        }
Esempio n. 25
0
        public void TestModerateHomePageUnlockAll()
        {
            DnaTestURLRequest request = new DnaTestURLRequest("moderation");
            request.UseEditorAuthentication = true;
            request.SetCurrentUserEditor();     
/*
            modHomeParams.UnlockForums = InputContext.DoesParamExist("UnlockForums", _docDnaUnlockForums);
            modHomeParams.UnlockForumReferrals = InputContext.DoesParamExist("UnlockForumReferrals", _docDnaUnlockForumReferrals);
            modHomeParams.UnlockUserPosts = InputContext.DoesParamExist("UnlockUserPosts", _docDnaUnlockUserPosts);
            modHomeParams.UnlockSitePosts = InputContext.DoesParamExist("UnlockSitePosts", _docDnaUnlockSitePosts);
            modHomeParams.UnlockAllPosts = InputContext.DoesParamExist("UnlockAllPosts", _docDnaUnlockAllPosts);
            modHomeParams.UnlockArticles = InputContext.DoesParamExist("UnlockArticles", _docDnaUnlockArticles);
            modHomeParams.UnlockArticleReferrals = InputContext.DoesParamExist("UnlockArticleReferrals", _docDnaUnlockArticleReferrals);
            modHomeParams.UnlockGeneral = InputContext.DoesParamExist("UnlockGeneral", _docDnaUnlockGeneral);
            modHomeParams.UnlockGeneralReferrals = InputContext.DoesParamExist("UnlockGeneralReferrals", _docDnaUnlockGeneralReferrals);
            modHomeParams.UnlockNicknames = InputContext.DoesParamExist("UnlockNicknames", _docDnaUnlockNicknames);
            modHomeParams.UnlockAll = InputContext.DoesParamExist("UnlockAll", _docDnaUnlockAll);
*/
            request.RequestSecurePage(@"moderationhome?UnlockForums=1&skin=purexml");
            request.RequestSecurePage(@"moderationhome?UnlockForumReferrals=1&skin=purexml");
            request.RequestSecurePage(@"moderationhome?UnlockUserPosts=1&skin=purexml");
            request.RequestSecurePage(@"moderationhome?UnlockSitePosts=1&skin=purexml&siteid=1");
            request.RequestSecurePage(@"moderationhome?UnlockAllPosts=1&skin=purexml");
            request.RequestSecurePage(@"moderationhome?UnlockArticles=1&skin=purexml");
            request.RequestSecurePage(@"moderationhome?UnlockArticleReferrals=1&skin=purexml");
            request.RequestSecurePage(@"moderationhome?UnlockGeneral=1&skin=purexml");
            request.RequestSecurePage(@"moderationhome?UnlockGeneralReferrals=1&skin=purexml");
            request.RequestSecurePage(@"moderationhome?UnlockNicknames=1&skin=purexml");
            request.RequestSecurePage(@"moderationhome?UnlockAll=1&skin=purexml");

            XmlDocument xml = request.GetLastResponseAsXML();
        }
Esempio n. 26
0
        public void TestCreateCommentForumWithUnicodeTitleAndThenChangeUnicodeTitle()
        {
            Console.WriteLine("Before CommentBoxTests - TestCreateCommentForumWithUnicodeTitleAndThenChangeUnicodeTitle");

            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.UseIdentitySignIn = true;
            request.UseEditorAuthentication = true;
            request.SetCurrentUserEditor();
            //request.SignUserIntoSSOViaWebRequest(DnaTestURLRequest.usertype.EDITOR);

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string encodedTitle = "\u041D\u0435 \u043F\u0430\u043D\u0438\u043A\u0443\u0439\u0442\u0435";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acs";

            string url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + encodedTitle + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.RequestPage(url);
            XmlDocument xml = request.GetLastResponseAsXML();
            string comment = "\u03CC\u03C7\u03B9 \u03C0\u03B1\u03BD\u03B9\u03BA\u03CC\u03C2" + uid;
            // Now check to make sure we can post to the comment box
            request.RequestSecurePage("acswithoutapi?dnauid=" + uid + "&dnaaction=add&dnacomment=" + comment + "&dnahostpageurl=" + hosturl + "&skin=purexml");
            // Check to make sure that the page returned with the correct information
            xml = request.GetLastResponseAsXML();

            string encodedNewTitle = "\u30D1\u30CB\u30C3\u30AF\u306B\u9665\u3063\u3066\u306F\u3044\u3051\u306A\u3044";
            url = "acswithoutapi?dnauid=" + uid + "&dnainitialtitle=" + encodedNewTitle + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";
            request.RequestSecurePage(url);
            // now get the response
            xml = request.GetLastResponseAsXML();
            Assert.IsTrue(xml.SelectSingleNode("/H2G2/COMMENTBOX/FORUMTHREADPOSTS/POST/COMMENTFORUMTITLE").InnerText == encodedNewTitle, "Forum Title has not been changed.");

            request.RequestPage("CommentForumList?dnaskip=0&dnashow=100&skin=purexml");
            // Check to make sure that the page returned with the correct information
            xml = request.GetLastResponseAsXML();

            Assert.IsTrue(xml.SelectSingleNode("H2G2/COMMENTFORUMLIST/COMMENTFORUM[@UID='" + uid + "']/TITLE").InnerText == encodedNewTitle, "The comment forum list page has not been generated correctly - COMMENTFORUMLISTTITLE!!!");

            Console.WriteLine("After CommentBoxTests - TestCreateCommentForumWithUnicodeTitleAndThenChangeUnicodeTitle");
        }
Esempio n. 27
0
        public void TestModerateHomePageXml()
        {
            DnaTestURLRequest request = new DnaTestURLRequest("moderation");
            //Cookie cookie;
            //string testUserName;
            //SetupIdentityEditorUser(request, out cookie, out testUserName);
            request.UseEditorAuthentication = true;
            request.SetCurrentUserEditor();            
            request.RequestSecurePage(@"moderationhome?skin=purexml");
            XmlDocument xml = request.GetLastResponseAsXML();

            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, "H2G2ModerateHome.xsd");
            validator.Validate();

            //TestUserCreator.DeleteIdentityUser(cookie, testUserName);
        }
Esempio n. 28
0
        public void TestCreateCommentSiteError()
        {
            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();

            // Setup the request url
            string uid = Guid.NewGuid().ToString();
            string title = "TestCreateCommentWithChangeSite";
            string hosturl = "http://" + _server + "/dna/haveyoursay/acsapi";

            string url = "acsapi?dnauid=" + uid + "&dnainitialtitle=" + title + "&dnahostpageurl=" + hosturl + "&dnaforumduration=0&skin=purexml";

            // now get the response
            request.RequestPage(url);

            // Now change site
            request = new DnaTestURLRequest("h2g2");
            request.SetCurrentUserNormal();

            request.RequestSecurePage("acsapi?dnauid=" + uid + "&dnaaction=add&dnacomment=TestCreateCommentWithChangeSite&dnahostpageurl=" + hosturl + "&skin=purexml");
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/ERROR[@TYPE='forumnotfound']") != null, "Error not created.");
          
        }