示例#1
0
文件: Setup.cs 项目: majorsilence/vpn
        public void BringUp()
        {
            // setup database and shit
            var email = new Majorsilence.Vpn.Logic.Email.FakeEmail();
            var setup = new Majorsilence.Vpn.Logic.InitializeSettings("localhost", testingdb, email, false);

            setup.Execute();


            // set test server ssh port
            using (var db = Majorsilence.Vpn.Logic.InitializeSettings.DbFactory)
            {
                db.Open();
                var siteInfo = db.Query <Majorsilence.Vpn.Poco.SiteInfo>("SELECT * FROM SiteInfo");

                // See Vagrantfile vpnauthoritytest for ssh port number
                siteInfo.First().SshPort            = 8023;
                siteInfo.First().StripeAPIPublicKey = "pk_test_DBLlRp19zx2pnEYPgbPszWFr";
                siteInfo.First().StripeAPISecretKey = "sk_test_d2130qPEHAk9VNSXSX7fQFB9";

                db.Update <Majorsilence.Vpn.Poco.SiteInfo>(siteInfo.First());


                db.Insert(new Majorsilence.Vpn.Poco.BetaKeys("abc1", false, false));
                db.Insert(new Majorsilence.Vpn.Poco.BetaKeys("abc2", false, false));
                db.Insert(new Majorsilence.Vpn.Poco.BetaKeys("abc3", false, false));
                db.Insert(new Majorsilence.Vpn.Poco.BetaKeys("abc4", false, false));
                db.Insert(new Majorsilence.Vpn.Poco.BetaKeys("abc5", false, false));
            }

            RetrieveLoginTokenAndAssert();
        }
示例#2
0
        public void ValidDataTest()
        {
            var email = new Majorsilence.Vpn.Logic.Email.FakeEmail();

            var    test    = new Majorsilence.Vpn.Logic.Accounts.BetaKeys(email);
            string betakey = test.MailInvite("*****@*****.**");


            using (var cn = Majorsilence.Vpn.Logic.InitializeSettings.DbFactory)
            {
                cn.Open();
                var data = cn.Query <Majorsilence.Vpn.Poco.BetaKeys>("SELECT * FROM BetaKeys WHERE Code=@Code", new { Code = betakey });

                Assert.That(data.First().IsUsed, Is.False);
                Assert.That(data.First().IsSent, Is.True);
            }
        }
示例#3
0
        public void BringUp()
        {
            UpVpnTestServer();

            // setup database and shit
            var email = new Majorsilence.Vpn.Logic.Email.FakeEmail();
            var setup = new Majorsilence.Vpn.Logic.InitializeSettings("localhost", testingdb, email, false);

            setup.Execute();

            // set test server ssh port
            using (IDbConnection db = Majorsilence.Vpn.Logic.InitializeSettings.DbFactory)
            {
                db.Open();
                var siteInfo = db.Query <Majorsilence.Vpn.Poco.SiteInfo> ("SELECT * FROM SiteInfo");

                // See Vagrantfile vpnauthoritytest for ssh port number
                siteInfo.First().SshPort = 8023;

                db.Update <Majorsilence.Vpn.Poco.SiteInfo> (siteInfo.First());
            }
        }