summaryrefslogtreecommitdiff
path: root/tests/libgit2/remote/list.c
blob: 4a6be3d1bf125d3da218680f721014146b064f70 (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
33
34
35
36
37
38
39
40
41
42
43
#include "clar_libgit2.h"
#include "config/config_helpers.h"

static git_repository *_repo;

#define TEST_URL "http://github.com/libgit2/libgit2.git"

void test_remote_list__initialize(void)
{
	_repo = cl_git_sandbox_init("testrepo");
}

void test_remote_list__cleanup(void)
{
	cl_git_sandbox_cleanup();
}

void test_remote_list__always_checks_disk_config(void)
{
	git_repository *repo;
	git_strarray remotes;
	git_remote *remote;

	cl_git_pass(git_repository_open(&repo, git_repository_path(_repo)));

	cl_git_pass(git_remote_list(&remotes, _repo));
	cl_assert_equal_sz(remotes.count, 1);
	git_strarray_dispose(&remotes);

	cl_git_pass(git_remote_create(&remote, _repo, "valid-name", TEST_URL));

	cl_git_pass(git_remote_list(&remotes, _repo));
	cl_assert_equal_sz(remotes.count, 2);
	git_strarray_dispose(&remotes);

	cl_git_pass(git_remote_list(&remotes, repo));
	cl_assert_equal_sz(remotes.count, 2);
	git_strarray_dispose(&remotes);

	git_repository_free(repo);
	git_remote_free(remote);
}