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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#define BOOST_TEST_MODULE GitFS_Service
#include <boost/test/data/test_case.hpp> // IWYU pragma: keep
#include <boost/test/unit_test.hpp>
#include "mockDefs.h"
#include <compileTimeFormatter.h>
#include <definedDirs.h>
#include <dryice.h>
#include <filesystem>
#include <memory>
#include <service.h>
#include <string>
namespace NetFS {
class AuthError;
class ConfigError;
}
using namespace GitFS;
using namespace GitFS::Test;
using namespace AdHoc::literals;
namespace btdata = boost::unit_test::data;
BOOST_DATA_TEST_CASE(
no_repos, btdata::make({"", "testrepo", "no repo"}) * btdata::make({"", "testauth", "badkey"}), repo, key)
{
IceTray::DryIce s;
Client c;
BOOST_CHECK_NO_THROW(c.s->ice_ping());
BOOST_CHECK_THROW(c.s->connect(repo, key), NetFS::ConfigError);
}
BOOST_DATA_TEST_CASE(badauth, btdata::make({"", "testAuth", "badkey"}), key)
{
IceTray::DryIce s({
"--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()),
"--GitFS.testrepo.authkey=testauth",
"--GitFS.testrepo.commitish=7a0ccb40084c3ab31d9856e7f689c0514c28c930",
});
Client c;
BOOST_CHECK_NO_THROW(c.s->ice_ping());
BOOST_CHECK_THROW(c.s->connect("testrepo", key), NetFS::AuthError);
}
BOOST_AUTO_TEST_CASE(missing_repo)
{
IceTray::DryIce s({
"--GitFS.missing.gitdir=/not/here",
"--GitFS.missing.commit=7a0ccb40084c3ab31d9856e7f689c0514c28c930",
"--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()),
"--GitFS.testrepo.commitish=7a0ccb40084c3ab31d9856e7f689c0514c28c931",
});
Client c;
BOOST_CHECK_NO_THROW(c.s->ice_ping());
BOOST_CHECK_THROW(c.s->connect("missing", {}), NetFS::ConfigError);
BOOST_CHECK_THROW(c.s->connect("testrepo", {}), NetFS::ConfigError);
}
|