Commit 784ff0b6 authored by Lukas Matt's avatar Lukas Matt

Initial commit

parents
# Federation Tests
This repository is about automating federation unit tests.
If you want to use travis, this could look like following:
```
sudo: required
services:
- docker
- postgresql
[...]
install:
- docker run --name=d1 -e DATABASE=d1 -e PORT=3000 -p 3000:3000 --net=host -d thefederation/testing_diaspora:latest
script:
- curl http://localhost:3000/hcard/users/2d4fa7e0e5380135fa593c970e8692d1
```
## Projects
For reference implementation you can checkout following projects:
* [github.com/ganggo/ganggo](https://github.com/ganggo/ganggo)
FROM thefederation/diaspora_image:v1.0.0
COPY post_like_comment.rb /diaspora/post_like_comment.rb
COPY share_with.rb /diaspora/share_with.rb
COPY schema.sql /diaspora/schema.sql
COPY start.sh /start.sh
CMD ["/bin/bash", "/start.sh"]
FROM debian:jessie
MAINTAINER Lukas Matt <lukas@zauberstuhl.de>
ENV DEBIAN_FRONTEND noninteractive
ENV RAILS_ENV production
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install libreadline-dev cmake build-essential libssl-dev libcurl4-openssl-dev libxml2-dev libxslt-dev imagemagick ghostscript curl libmagickwand-dev git libpq-dev redis-server nodejs postgresql-client
RUN mkdir /tmp/ruby && cd /tmp/ruby \
&& curl -L --progress http://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.2.tar.gz | tar xz \
&& cd ruby-2.4.2 \
&& ./configure --disable-install-rdoc \
&& make -j2 \
&& make install
RUN gem install bundler
RUN git clone --depth 1 https://github.com/diaspora/diaspora.git
WORKDIR /diaspora
RUN cp config/database.yml.example config/database.yml \
&& cp config/diaspora.yml.example config/diaspora.yml
RUN bundle install --with postgresql
RUN sed -i "s/#rails_environment:.*/rails_environment: 'production'/" config/diaspora.yml
RUN sed -i "s/#url:/url:/" config/diaspora.yml
RUN sed -i "0,/#certificate_authorities/ s/#certificate_authorities:/certificate_authorities:/" config/diaspora.yml
RUN bundle exec rake db:create db:migrate assets:precompile
# Building
Requires a local postgres database then run:
```
docker build --network=host -t thefederation/diaspora_image:<tag> .
```
user = User.find_by(username: ARGV[0])
publicPost = StatusMessageCreationService.new(user).create(
status_message: {
text: "StatusMessageCreationService publicPost"
},
public: true
)
privatePost = StatusMessageCreationService.new(user).create(
status_message: {
text: "StatusMessageCreationService privatePost"
},
public: false,
aspect_ids: [1]
)
CommentService.new(user).create(publicPost.id, "publicComment")
CommentService.new(user).create(privatePost.id, "privateComment")
LikeService.new(user).create(publicPost.id)
LikeService.new(user).create(privatePost.id)
This source diff could not be displayed because it is too large. You can view the blob instead.
user = User.find_by(username: ARGV[0])
Workers::FetchWebfinger.perform_async(ARGV[1])
person = Person.find_by(diaspora_handle: ARGV[1])
aspect = Aspect.find_by(id: 1)
user.share_with(person, aspect)
#!/bin/bash
cd /diaspora \
&& sed -i "s/USERNAME/$DATABASE/g" schema.sql \
&& sed -i "s/GUID/$DATABASE/" schema.sql \
&& sed -i "s/PORT/$PORT/g" schema.sql \
&& sed -i "s/database: diaspora_development/database: $DATABASE/" config/database.yml \
&& sed -i "s/url: \".*\"/url: \"http:\/\/localhost:$PORT\/\"/" config/diaspora.yml \
&& bundle exec rails db:migrate \
&& psql -U postgres -h localhost -p 5432 -d $DATABASE < schema.sql \
&& ./script/server
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment