aboutsummaryrefslogtreecommitdiff
path: root/cmd/anubis/internal/config/config_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/anubis/internal/config/config_test.go')
-rw-r--r--cmd/anubis/internal/config/config_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/cmd/anubis/internal/config/config_test.go b/cmd/anubis/internal/config/config_test.go
index f362a76..0903fbb 100644
--- a/cmd/anubis/internal/config/config_test.go
+++ b/cmd/anubis/internal/config/config_test.go
@@ -87,6 +87,48 @@ func TestBotValid(t *testing.T) {
},
err: ErrInvalidPathRegex,
},
+ {
+ name: "challenge difficulty too low",
+ bot: Bot{
+ Name: "mozilla-ua",
+ Action: RuleChallenge,
+ PathRegex: p("Mozilla"),
+ Challenge: &ChallengeRules{
+ Difficulty: 0,
+ ReportAs: 4,
+ Algorithm: "fast",
+ },
+ },
+ err: ErrChallengeDifficultyTooLow,
+ },
+ {
+ name: "challenge difficulty too high",
+ bot: Bot{
+ Name: "mozilla-ua",
+ Action: RuleChallenge,
+ PathRegex: p("Mozilla"),
+ Challenge: &ChallengeRules{
+ Difficulty: 420,
+ ReportAs: 4,
+ Algorithm: "fast",
+ },
+ },
+ err: ErrChallengeDifficultyTooHigh,
+ },
+ {
+ name: "challenge wrong algorithm",
+ bot: Bot{
+ Name: "mozilla-ua",
+ Action: RuleChallenge,
+ PathRegex: p("Mozilla"),
+ Challenge: &ChallengeRules{
+ Difficulty: 420,
+ ReportAs: 4,
+ Algorithm: "high quality rips",
+ },
+ },
+ err: ErrChallengeRuleHasWrongAlgorithm,
+ },
}
for _, cs := range tests {