diff options
author | =Corey Hulen <corey@hulen.com> | 2015-06-14 23:53:32 -0800 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2015-06-14 23:53:32 -0800 |
commit | cf7a05f80f68b5b1c8bcc0089679dd497cec2506 (patch) | |
tree | 70007378570a6962d7c175ca96af732b71aeb6da /web/web_test.go | |
download | chat-cf7a05f80f68b5b1c8bcc0089679dd497cec2506.tar.gz chat-cf7a05f80f68b5b1c8bcc0089679dd497cec2506.tar.bz2 chat-cf7a05f80f68b5b1c8bcc0089679dd497cec2506.zip |
first commit
Diffstat (limited to 'web/web_test.go')
-rw-r--r-- | web/web_test.go | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/web/web_test.go b/web/web_test.go new file mode 100644 index 000000000..ff37b74d5 --- /dev/null +++ b/web/web_test.go @@ -0,0 +1,53 @@ +// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// See License.txt for license information. + +package web + +import ( + "github.com/mattermost/platform/api" + "github.com/mattermost/platform/model" + "github.com/mattermost/platform/utils" + "net/http" + "testing" + "time" +) + +var ApiClient *model.Client +var URL string + +func Setup() { + if api.Srv == nil { + utils.LoadConfig("config.json") + api.NewServer() + api.StartServer() + api.InitApi() + InitWeb() + URL = "http://localhost:" + utils.Cfg.ServiceSettings.Port + ApiClient = model.NewClient(URL + "/api/v1") + } +} + +func TearDown() { + if api.Srv != nil { + api.StopServer() + } +} + +func TestStatic(t *testing.T) { + Setup() + + resp, _ := http.Get(URL + "/static/images/favicon.ico") + + if resp.StatusCode != http.StatusOK { + t.Fatalf("couldn't get static files %v", resp.StatusCode) + } +} + +func TestZZWebTearDown(t *testing.T) { + // *IMPORTANT* + // This should be the last function in any test file + // that calls Setup() + // Should be in the last file too sorted by name + time.Sleep(2 * time.Second) + TearDown() +} |