summaryrefslogtreecommitdiffstats
path: root/integrations/api_repo_raw_test.go
blob: 62b734fa060a20df4ae7a9bcc1aa34dac22b662b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2017 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package integrations

import (
	"net/http"
	"testing"

	"code.gitea.io/gitea/models"
)

func TestAPIReposRaw(t *testing.T) {
	defer prepareTestEnv(t)()
	user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
	// Login as User2.
	session := loginUser(t, user.Name)
	token := getTokenForLoggedInUser(t, session)

	for _, ref := range [...]string{
		"master", // Branch
		"v1.1",   // Tag
		"65f1bf27bc3bf70f64657658635e66094edbcb4d", // Commit
	} {
		req := NewRequestf(t, "GET", "/api/v1/repos/%s/repo1/raw/%s/README.md?token="+token, user.Name, ref)
		session.MakeRequest(t, req, http.StatusOK)
	}
	// Test default branch
	req := NewRequestf(t, "GET", "/api/v1/repos/%s/repo1/raw/README.md?token="+token, user.Name)
	session.MakeRequest(t, req, http.StatusOK)
}
pan class="w"> *L, const char *index, const char *value); int lua_class_tostring (lua_State *L); int luaopen_message (lua_State *L); int luaopen_task (lua_State *L); int luaopen_config (lua_State *L); int luaopen_metric (lua_State *L); int luaopen_radix (lua_State *L); int luaopen_hash_table (lua_State *L); int luaopen_textpart (lua_State *L); int luaopen_classifier (lua_State *L); int luaopen_statfile (lua_State * L); void init_lua (struct config_file *cfg); void init_lua_filters (struct config_file *cfg); /* Filters functions */ int lua_call_filter (const char *function, struct worker_task *task); int lua_call_chain_filter (const char *function, struct worker_task *task, int *marks, unsigned int number); double lua_consolidation_func (struct worker_task *task, const char *metric_name, const char *function_name); gboolean lua_call_expression_func (const char *function, struct worker_task *task, GList *args, gboolean *res); void add_luabuf (const char *line); /* Classify functions */ GList *call_classifier_pre_callbacks (struct classifier_config *ccf, struct worker_task *task); double call_classifier_post_callbacks (struct classifier_config *ccf, struct worker_task *task, double in); double lua_normalizer_func (struct config_file *cfg, long double score, void *params); /* Config file functions */ void lua_post_load_config (struct config_file *cfg); void lua_process_element (struct config_file *cfg, const char *name, struct module_opt *opt, int idx); gboolean lua_handle_param (struct worker_task *task, gchar *mname, gchar *optname, enum lua_var_type expected_type, gpointer *res); #endif /* WITH_LUA */ #endif /* RSPAMD_LUA_H */