public When_config_variables_are_entered()
        {
            _Deploy = new Mock <IDeploymentService>(MockBehavior.Strict);
            string slug;

            _Deploy.Setup(d => d.Deploy(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <App>(), It.IsAny <Dictionary <string, string> >(), out slug))
            .Returns(DeploymentResult.Success)
            .Callback <string, string, App, Dictionary <string, string>, string>((name, region, app, vars, alug) =>
            {
                _ReceivedVars = vars;
            });;
            _Browser = Testing.CreateBrowser <SecuredPagesModule>(with =>
            {
                with.LoggedInUser();
                with.Deployment(_Deploy);
            });
            _Response = _Browser.Post("/Deploy/jabbr", with =>
            {
                with.FormValue("application_name", "JabbR Test");
                with.FormValue("region_id", "amazon-web-services::us-east-1");
                with.FormValue("auth.apiKey", "test api key");
                with.FormValue("auth.appName", "test app name");
                with.FormValue("googleAnalytics", "test analytics key");
            });
        }
Esempio n. 2
0
 public When_user_signs_out()
 {
     _Browser = Testing.CreateBrowser <OAuthModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Get("/SignOut");
 }
Esempio n. 3
0
 public When_requesting_an_app_that_doesnt_exist()
 {
     _Browser = Testing.CreateBrowser <SecuredPagesModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Get("/Deploy/foofoo");
 }
Esempio n. 4
0
 public When_displaying_the_deploy_page()
 {
     _Browser = Testing.CreateBrowser <SecuredPagesModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Get("/Deploy/jabbr");
 }
 public When_a_success_message_is_present()
 {
     _Browser = Testing.CreateBrowser <PagesModule>(with =>
     {
         with.Session(SessionKeys.FLASH_SUCCESS, "All done!");
     });
     _Response = _Browser.Get("/");
 }
Esempio n. 6
0
 public When_no_payload_is_sent()
 {
     _Browser  = Testing.CreateBrowser <HookModule>();
     _Response = _Browser.Post("/Sites/foofoo/NotifyByEmail", with =>
     {
         with.Query("email", "*****@*****.**");
     });
 }
 public When_an_error_message_is_present()
 {
     _Browser = Testing.CreateBrowser <PagesModule>(with =>
     {
         with.Session(SessionKeys.FLASH_ERROR, "There was an error!");
     });
     _Response = _Browser.Get("/");
 }
Esempio n. 8
0
 public When_user_is_logged_on()
 {
     _Browser = Testing.CreateBrowser <PagesModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Get("/");
 }
Esempio n. 9
0
 public When_no_email_is_passed()
 {
     _Api     = new Mock <IApiService>(MockBehavior.Strict);
     _Browser = Testing.CreateBrowser <SecuredPagesModule>(with =>
     {
         with.LoggedInUser();
         with.Api(_Api);
     });
     _Response = _Browser.Put("/Sites/testsite/Notifications/Email");
 }
Esempio n. 10
0
 public When_requesting_the_sign_in_page()
 {
     _OAuth = new Mock <IOAuth>(MockBehavior.Strict);
     _OAuth.Setup(d => d.GetAuthUrl()).Returns("http://www.test.com");
     _Browser = Testing.CreateBrowser <OAuthModule>(with =>
     {
         with.OAuth(_OAuth);
     });
     _Response = _Browser.Get("/SignIn");
 }
 public When_no_application_name_is_specified()
 {
     _Browser = Testing.CreateBrowser <SecuredPagesModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Post("/Deploy/jabbr", with =>
     {
         with.FormValue("region_id", "amazon-web-services::us-east-1");
     });
 }
Esempio n. 12
0
 public When_no_code_is_sent()
 {
     _OAuth   = new Mock <IOAuth>(MockBehavior.Strict);
     _Browser = Testing.CreateBrowser <OAuthModule>(with =>
     {
         with.OAuth(_OAuth);
     });
     _Response = _Browser.Get("/callback", with =>
     {
     });
 }
Esempio n. 13
0
 public When_no_region_id_is_specified()
 {
     _Browser = Testing.CreateBrowser <SecuredPagesModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Post("/Deploy/jabbr", with =>
     {
         with.FormValue("application_name", "foo");
     });
 }
Esempio n. 14
0
 public When_a_redirect_url_is_specified()
 {
     _OAuth = new Mock <IOAuth>(MockBehavior.Strict);
     _OAuth.Setup(d => d.GetAuthUrl()).Returns("http://www.test.com");
     _Browser = Testing.CreateBrowser <OAuthModule>(with =>
     {
         with.OAuth(_OAuth);
     });
     _Response = _Browser.Get("/SignIn", with =>
     {
         with.Query("redirect", "/Test");
     });
 }
Esempio n. 15
0
 public When_code_can_not_be_exchanged_for_access_token()
 {
     _OAuth = new Mock <IOAuth>(MockBehavior.Strict);
     _OAuth.Setup(d => d.GetAccessToken(It.IsAny <string>())).Returns((string)null);
     _Browser = Testing.CreateBrowser <OAuthModule>(with =>
     {
         with.OAuth(_OAuth);
     });
     _Response = _Browser.Get("/callback", with =>
     {
         with.Query("code", "testcode");
     });
 }
Esempio n. 16
0
 public When_oauth_callback_is_received()
 {
     _OAuth = new Mock <IOAuth>(MockBehavior.Strict);
     _OAuth.Setup(d => d.GetAccessToken(It.IsAny <string>())).Returns("12345");
     _Browser = Testing.CreateBrowser <OAuthModule>(with =>
     {
         with.OAuth(_OAuth);
     });
     _Response = _Browser.Get("/callback", with =>
     {
         with.Query("code", "testcode");
     });
 }
 public When_a_redirect_was_specified()
 {
     _OAuth = new Mock <IOAuth>(MockBehavior.Strict);
     _OAuth.Setup(d => d.GetAccessToken(It.IsAny <string>())).Returns("12345");
     _Browser = Testing.CreateBrowser <OAuthModule>(with =>
     {
         with.OAuth(_OAuth);
         with.Session(SessionKeys.SIGN_IN_REDIRECT, "/Test");
     });
     _Response = _Browser.Get("/callback", with =>
     {
         with.Query("code", "testcode");
     });
 }
Esempio n. 18
0
        public When_displaying_the_sites_page()
        {
            var api = new Mock <IApiService>(MockBehavior.Strict);

            api.Setup(d => d.GetApplications()).Returns(new[] { new Application {
                                                                    Slug = "test", Name = "My Test Site"
                                                                } });

            _Browser = Testing.CreateBrowser <SecuredPagesModule>(with =>
            {
                with.LoggedInUser();
                with.Api(api);
            });
            _Response = _Browser.Get("/Sites");
        }
        public When_application_creation_fails()
        {
            _Deploy = new Mock <IDeploymentService>(MockBehavior.Strict);
            string slug;

            _Deploy.Setup(d => d.Deploy(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <App>(), It.IsAny <Dictionary <string, string> >(), out slug)).Returns(DeploymentResult.UnableToCreateApplication);
            _Browser = Testing.CreateBrowser <SecuredPagesModule>(with =>
            {
                with.LoggedInUser();
                with.Deployment(_Deploy);
            });
            _Response = _Browser.Post("/Deploy/jabbr", with =>
            {
                with.FormValue("application_name", "JabbR Test");
                with.FormValue("region_id", "amazon-web-services::us-east-1");
            });
        }
Esempio n. 20
0
        public When_enabling_a_notification()
        {
            _Api = new Mock <IApiService>(MockBehavior.Strict);
            _Api.Setup(d => d.CreateServicehook(It.IsAny <string>(), It.IsAny <string>())).Returns(new CreateResult {
                Status = CreateStatus.Created
            });

            _Browser = Testing.CreateBrowser <SecuredPagesModule>(with =>
            {
                with.LoggedInUser();
                with.Api(_Api);
            });
            _Response = _Browser.Put("/Sites/testsite/Notifications/Email", ctx =>
            {
                ctx.FormValue("email", "*****@*****.**");
            });
        }
Esempio n. 21
0
 public When_a_notification_is_sent()
 {
     _Mail = new Mock <IMailService>(MockBehavior.Strict);
     _Mail.Setup(d => d.SendEmail(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()));
     _Browser = Testing.CreateBrowser <HookModule>(with =>
     {
         with.Mail(_Mail);
     });
     _Response = _Browser.Post("/Sites/foofoo/NotifyByEmail", with =>
     {
         with.JsonBody(new ServiceHookModel {
             Application = new ServiceHookApplicationModel {
                 Name = "Foo Foo"
             }, Build = new ServiceHookBuildModel {
                 Status = "Succeeded", Commit = new ServiceHookCommitModel {
                     Id = "12345", Message = "Test Message"
                 }
             }
         });
         with.Query("email", "*****@*****.**");
     });
 }
 public When_an_anonymous_user_calls_sites()
 {
     _Browser  = Testing.CreateBrowser <SecuredPagesModule>();
     _Response = _Browser.Get("/Sites");
 }
Esempio n. 23
0
 public When_displaying_the_home_page()
 {
     _Browser  = Testing.CreateBrowser <PagesModule>();
     _Response = _Browser.Get("/");
 }
Esempio n. 24
0
 public When_no_user_is_logged_on()
 {
     _Browser  = Testing.CreateBrowser <PagesModule>();
     _Response = _Browser.Get("/");
 }
Esempio n. 25
0
 public When_requesting_static_content()
 {
     _Browser = Testing.CreateBrowser <PagesModule>();
 }
Esempio n. 26
0
 public When_no_email_is_sent()
 {
     _Browser  = Testing.CreateBrowser <HookModule>();
     _Response = _Browser.Post("/Sites/foofoo/NotifyByEmail");
 }