Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix cram tests

  • Loading branch information...
commit 9dd63fda975859ea118e59429664be871b566e18 1 parent 09f8c4e
@posativ authored
Showing with 45 additions and 40 deletions.
  1. +2 −1  regenwolken/__init__.py
  2. +1 −1  regenwolken/views.py
  3. +42 −38 specs/behavior.t
View
3  regenwolken/__init__.py
@@ -41,7 +41,6 @@ def __init__(self):
self.setup_routes()
self.setup_mongodb()
self.setup_extensions()
- self.setup_logger()
def setup_routes(self):
@@ -126,5 +125,7 @@ def main():
if '--debug' in sys.argv:
app.debug = True
+ else:
+ app.setup_logger()
app.run(host=app.config['BIND_ADDRESS'], port=app.config['PORT'])
View
2  regenwolken/views.py
@@ -189,7 +189,7 @@ def items_new():
key = current_app.sessions.new(request.authorization.username)
- res = { "url": request.url_root,
+ res = { "url": 'http://' + current_app.config['HOSTNAME'],
"max_upload_size": current_app.config['MAX_CONTENT_LENGTH'],
"params": { "acl": privacy,
"key": key
View
80 specs/behavior.t
@@ -2,17 +2,21 @@ Testing MANIFEST.in
$ [ -n "$PYTHON" ] || PYTHON="`which python`"
$ LANG="de_DE.UTF-8" && unset LC_ALL && unset LANGUAGE
- $ PREFIX="`python -c 'import sys; print sys.prefix'`"
$ LOGFILE="/tmp/rw.log"
$ echo "y" | rwctl purge -a --all
delete all accounts? [y/n] deleting ? accounts (glob)
Does it actually works?
- $ env REGENWOLKEN_SETTINGS="$TESTDIR/../regenwolken.cfg" regenwolken > $LOGFILE 2>&1 &
- $ PID=$!
+ $ echo "HOSTNAME = 'localhost:3000'" > "$(pwd)/rw.cfg"
+ $ export REGENWOLKEN_SETTINGS="$(pwd)/rw.cfg"
+ $ regenwolken --debug > $LOGFILE 2>&1 &
+ $ PID="$!"
- $ cloudapp -y register foo 1234
+If we do not sleep here, cram says "Fuck you" and you fall in deep depressions
+ $ sleep 1
+
+ $ cloudapp --service localhost:3000 -y register foo 1234
Successfully registered but your account isn't currently activated.
Saving login to local login storage .+ (re)
@@ -20,82 +24,82 @@ Does it actually works?
`foo` activated
$ echo "Hello World" > README.md
- $ cloudapp upload README.md
+ $ cloudapp --service localhost:3000 upload README.md
Created item \w+, URL: (re)
- http://localhost/\w+ (re)
+ http://localhost:3000/\w+ (re)
- $ cloudapp list --disable-colors
+ $ cloudapp --service localhost:3000 list --disable-colors
SLUG p=private, d=deleted
- \w+ -- unknown [^ ]+ [^ ]+ http://localhost/\w+ README.md (re)
+ \w+ -- unknown [^ ]+ [^ ]+ http://localhost:3000/\w+ README.md (re)
$ echo "Foo Bar " > foo.txt
- $ URL=$(cloudapp upload foo.txt | tail -n 1)
- $ cloudapp view $(basename $URL)
+ $ URL=$(cloudapp --service localhost:3000 upload foo.txt | tail -n 1)
+ $ cloudapp --service localhost:3000 view $(basename $URL)
Details for \w+: (re)
Name: foo.txt
Type: text
- URL: http://localhost/\w+ (re)
+ URL: http://localhost:3000/\w+ (re)
Privacy: public
Views: 0
Created: ??. ??? ???? ??:??:?? (glob)
Updated: ??. ??? ???? ??:??:?? (glob)
- $ cloudapp private $(basename $URL) > /dev/null
- $ cloudapp list --disable-colors
+ $ cloudapp --service localhost:3000 private $(basename $URL) > /dev/null
+ $ cloudapp --service localhost:3000 list --disable-colors
SLUG p=private, d=deleted
- \w+ -- unknown [^ ]+ [^ ]+ http://localhost/\w+ README.md (re)
- \w+ p- text [^ ]+ [^ ]+ http://localhost/\w+ foo.txt (re)
+ \w+ -- unknown [^ ]+ [^ ]+ http://localhost:3000/\w+ README.md (re)
+ \w+ p- text [^ ]+ [^ ]+ http://localhost:3000/\w+ foo.txt (re)
- $ cloudapp public $(basename $URL) > /dev/null
- $ cloudapp list --disable-colors
+ $ cloudapp --service localhost:3000 public $(basename $URL) > /dev/null
+ $ cloudapp --service localhost:3000 list --disable-colors
SLUG p=private, d=deleted
- \w+ -- unknown [^ ]+ [^ ]+ http://localhost/\w+ README.md (re)
- \w+ -- text [^ ]+ [^ ]+ http://localhost/\w+ foo.txt (re)
+ \w+ -- unknown [^ ]+ [^ ]+ http://localhost:3000/\w+ README.md (re)
+ \w+ -- text [^ ]+ [^ ]+ http://localhost:3000/\w+ foo.txt (re)
Delete an item (note that this will *not* actually delete the item but mark it as deleted). Next
we will recover it.
- $ cloudapp delete $(basename $URL) > /dev/null
- $ cloudapp list --disable-colors
+ $ cloudapp --service localhost:3000 delete $(basename $URL) > /dev/null
+ $ cloudapp --service localhost:3000 list --disable-colors
SLUG p=private, d=deleted
- \w+ -- unknown [^ ]+ [^ ]+ http://localhost/\w+ README.md (re)
+ \w+ -- unknown [^ ]+ [^ ]+ http://localhost:3000/\w+ README.md (re)
- $ cloudapp recover $(basename $URL) > /dev/null
- $ cloudapp list --disable-colors
+ $ cloudapp --service localhost:3000 recover $(basename $URL) > /dev/null
+ $ cloudapp --service localhost:3000 list --disable-colors
SLUG p=private, d=deleted
- \w+ -- unknown [^ ]+ [^ ]+ http://localhost/\w+ README.md (re)
- \w+ -- text [^ ]+ [^ ]+ http://localhost/\w+ foo.txt (re)
+ \w+ -- unknown [^ ]+ [^ ]+ http://localhost:3000/\w+ README.md (re)
+ \w+ -- text [^ ]+ [^ ]+ http://localhost:3000/\w+ foo.txt (re)
But we have a kill switch... let's try.
- $ cloudapp delete $(basename $URL) > /dev/null
- $ curl -su foo:1234 --digest -H "Accept: application/json" -X POST http://my.cl.ly/items/trash
- $ cloudapp list --disable-colors --deleted
+ $ cloudapp --service localhost:3000 delete $(basename $URL) > /dev/null
+ $ curl -su foo:1234 --digest -H "Accept: application/json" -X POST http://localhost:3000/items/trash
+ $ cloudapp --service localhost:3000 list --disable-colors --deleted
SLUG p=private, d=deleted
- \w+ -- unknown [^ ]+ [^ ]+ http://localhost/\w+ README.md (re)
+ \w+ -- unknown [^ ]+ [^ ]+ http://localhost:3000/\w+ README.md (re)
So now back to some basic stuff. Try to change our password to a more difficult one.
- $ cloudapp change -y password 123456 > /dev/null
- $ (curl -sI -u foo:123456 --digest http://localhost/items | grep FORBIDDEN)
+ $ cloudapp --service localhost:3000 change -y password 123456 > /dev/null
+ $ (curl -sI -u foo:123456 --digest http://localhost:3000/items | grep FORBIDDEN)
[1]
Try the URL shortening service.
- $ URL=$(cloudapp bookmark foo http://google.com/ | tail -n 1)
- $ cloudapp list --disable-colors
+ $ URL=$(cloudapp --service localhost:3000 bookmark foo http://google.com/ | tail -n 1)
+ $ cloudapp --service localhost:3000 list --disable-colors
SLUG p=private, d=deleted
- \w+ -- unknown [^ ]+ [^ ]+ http://localhost/\w+ README.md (re)
- \w+ -- bookmark [^ ]+ [^ ]+ http://localhost/\w+ http://google.com/ -> foo (re)
+ \w+ -- unknown [^ ]+ [^ ]+ http://localhost:3000/\w+ README.md (re)
+ \w+ -- bookmark [^ ]+ [^ ]+ http://localhost:3000/\w+ http://google.com/ -> foo (re)
$ curl -Is $URL | head -n 1
HTTP/1.0 302 FOUND
Minors
- $ curl -s http://my.cl.ly/domains/foo.bar
+ $ curl -s http://localhost:3000/domains/foo.bar
{
- "home_page": "http://localhost"
+ "home_page": "http://localhost:3000"
} (no-eol)
End this madness...

0 comments on commit 9dd63fd

Please sign in to comment.
Something went wrong with that request. Please try again.