Wrestling with tests while pushing random changes.

This commit is contained in:
Azareal 2019-10-13 20:50:15 +10:00
parent f8e0c5635c
commit fd1d54c394
4 changed files with 18 additions and 13 deletions

View File

@ -32,7 +32,8 @@ func (s *DefaultBlockStore) IsBlockedBy(blocker, blockee int) (bool, error) {
}
func (s *DefaultBlockStore) Add(blocker, blockee int) error {
return nil
_, err := s.add.Exec(blocker, blockee)
return err
}
type FriendInvite struct {
@ -64,11 +65,15 @@ func NewDefaultFriendStore(acc *qgen.Accumulator) (*DefaultFriendStore, error) {
}
func (s *DefaultFriendStore) AddInvite(requester, target int) error {
return nil
_, err := s.addInvite.Exec(requester, target)
return err
}
func (s *DefaultFriendStore) Confirm(requester, target int) error {
return nil
_, err := s.confirm.Exec(requester, target)
return err
}
func (s *DefaultFriendStore) GetOwnSentInvites(uid int) ([]FriendInvite, error) {
return nil, nil
}

View File

@ -202,6 +202,8 @@ func TestParser(t *testing.T) {
l.Add("//"+url+"\n//"+url, eurl+"<br>"+eurl)
l.Add("//"+url+"\n\n//"+url, eurl+"<br><br>"+eurl)
pre2 := c.Site.EnableSsl
c.Site.EnableSsl = true
local := func(u string) {
s := "//" + c.Site.URL
fs := "http://" + c.Site.URL
@ -288,8 +290,6 @@ func TestParser(t *testing.T) {
l.Add("@-1", "<red>[Invalid Profile]</red>1")
// TODO: Fix this hack and make the results a bit more reproducible, push the tests further in the process.
pre2 := c.Site.EnableSsl
c.Site.EnableSsl = true
for _, item := range l.Items {
if res := c.ParseMessage(item.Msg, 1, "forums"); res != item.Expects {
if item.Name != "" {

View File

@ -61,10 +61,10 @@ func ForumsCreateSubmit(w http.ResponseWriter, r *http.Request, user c.User) c.R
return c.NoPermissions(w, r, user)
}
fname := r.PostFormValue("forum-name")
fdesc := r.PostFormValue("forum-desc")
fpreset := c.StripInvalidPreset(r.PostFormValue("forum-preset"))
factive := r.PostFormValue("forum-active")
fname := r.PostFormValue("name")
fdesc := r.PostFormValue("desc")
fpreset := c.StripInvalidPreset(r.PostFormValue("preset"))
factive := r.PostFormValue("active")
active := (factive == "on" || factive == "1")
_, err := c.Forums.Create(fname, fdesc, active, fpreset)

View File

@ -37,22 +37,22 @@
<form action="/panel/forums/create/?s={{.CurrentUser.Session}}" method="post">
<div class="formrow">
<div class="formitem formlabel"><a>{{lang "panel.forums_create_name_label"}}</a></div>
<div class="formitem"><input name="forum-name" type="text" placeholder="{{lang "panel.forums_create_name"}}" /></div>
<div class="formitem"><input name="name" type="text" placeholder="{{lang "panel.forums_create_name"}}" /></div>
</div>
<div class="formrow">
<div class="formitem formlabel"><a>{{lang "panel.forums_create_description_label"}}</a></div>
<div class="formitem"><input name="forum-desc" type="text" placeholder="{{lang "panel.forums_create_description"}}" /></div>
<div class="formitem"><input name="desc" type="text" placeholder="{{lang "panel.forums_create_description"}}" /></div>
</div>
<div class="formrow">
<div class="formitem formlabel"><a>{{lang "panel.forums_active_label"}}</a></div>
<div class="formitem"><select name="forum-active">
<div class="formitem"><select name="active">
<option selected value="1">{{lang "option_yes"}}</option>
<option value="0">{{lang "option_no"}}</option>
</select></div>
</div>
<div class="formrow">
<div class="formitem formlabel"><a>{{lang "panel.forums_preset_label"}}</a></div>
<div class="formitem"><select name="forum-preset">
<div class="formitem"><select name="preset">
<option selected value="all">{{lang "panel_preset_everyone"}}</option>
<option value="announce">{{lang "panel_preset_announcements"}}</option>
<option value="members">{{lang "panel_preset_member_only"}}</option>