summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2014-05-17 10:12:09 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2014-05-17 10:12:09 +0100
commita5f2e7debbbf35ceeeca33bc35db0596c8ed814f (patch)
tree69f0cd041a33f9a5227b61e50646d4ef2ed4e29c
parent0a32e641a59199343cf3ae4fbe61546f00047a57 (diff)
downloadgitano-a5f2e7debbbf35ceeeca33bc35db0596c8ed814f.tar.bz2
Add tests for config
-rw-r--r--testing/02-commands-config.yarn91
1 files changed, 91 insertions, 0 deletions
diff --git a/testing/02-commands-config.yarn b/testing/02-commands-config.yarn
index f282cb0..fb8f61f 100644
--- a/testing/02-commands-config.yarn
+++ b/testing/02-commands-config.yarn
@@ -1 +1,92 @@
<!-- -*- markdown -*- -->
+config ---- View and change configuration for a repository (Takes a repo)
+=========================================================================
+
+The `config` command allows the repository's configuration file (clod) to be
+queried and updated from the command line without cloning, editing, and pushing
+the `refs/gitano/admin` branch.
+
+Initially there are three configuration values set for a project, namely that
+of its owner, description and `HEAD` reference. We can check these out
+directly, allowing us to verify the initial configuration. However, the config
+stored is a generic clod configuration so we should also verify everything we
+can about the behaviour from there.
+
+Viewing initial `config` for a repo
+-----------------------------------
+
+Initially configuration for owner, description and `HEAD` are supplied to a
+repository when created. `HEAD` is defaulted to `refs/heads/master` but the
+owner can be set via the person running the create.
+
+ SCENARIO Viewing initial `config` for a repo
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey runs create testrepo
+ AND testinstance adminkey runs config testrepo show
+ THEN stderr is empty
+ AND stdout contains project.owner: admin
+ AND stdout contains project.head: refs/heads/master
+
+Configuration changes stick
+---------------------------
+
+When setting configuration variables we expect those values to stick. As such
+we configure a test repository with a value which is not default and then check
+for it.
+
+ SCENARIO Configuration changes stick
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey runs create testrepo
+ AND testinstance adminkey runs config testrepo set project.head refs/heads/trunk
+ AND testinstance adminkey runs config testrepo show
+ THEN stderr is empty
+ AND stdout contains project.head: refs/heads/trunk
+
+Changes to `HEAD` and description hit the filesystem
+----------------------------------------------------
+
+Since the project's description affects things outside of Gitano, verify that
+when changing configuration, all relevant hook sections are run to update the
+outside world.
+
+ SCENARIO Changes to `HEAD` and description hit the filesystem
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey runs create testrepo
+ AND testinstance adminkey runs config testrepo set project.head refs/heads/trunk
+ AND testinstance adminkey runs config testrepo set project.description foobar
+ THEN server-side testrepo.git file description contains foobar
+ AND server-side testrepo.git file HEAD contains refs/heads/trunk
+
+Manipulating list values is possible
+------------------------------------
+
+Clod can contain lists in values. Lists are always one-level and can have
+new items appended...
+
+ SCENARIO Manipulating list values is possible
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey runs create testrepo
+ AND testinstance adminkey runs config testrepo set foo.* hello
+ AND testinstance adminkey runs config testrepo set foo.* world
+ AND testinstance adminkey runs config testrepo show
+ THEN stderr is empty
+ AND stdout contains foo.i_1: hello
+ AND stdout contains foo.i_2: world
+
+...and removed in any order...
+
+ WHEN testinstance adminkey runs config testrepo rm foo.i_1
+ AND testinstance adminkey runs config testrepo show
+ THEN stderr is empty
+ AND stdout contains foo.i_1: world
+
+ WHEN testinstance adminkey runs config testrepo rm foo.i_1
+ AND testinstance adminkey runs config testrepo show
+ THEN stderr is empty
+ AND stdout does not contain foo.i_
+
+FIXME: Once we have ruleset control, add more here perhaps