Permalink
Browse files

Delete old test files

  • Loading branch information...
Akron
Akron committed Mar 5, 2013
1 parent 5dfa73b commit 085826249a188c988c56c6fe7be9153013e6ea2b
Showing with 0 additions and 417 deletions.
  1. +0 −94 t/piwik-opt-out.t
  2. +0 −130 t/piwik-track.t
  3. +0 −193 t/piwik.t
View
@@ -1,94 +0,0 @@
-#!/usr/bin/env perl
-use Test::Mojo;
-use Test::More;
-use Mojolicious::Lite;
-use Mojo::JSON;
-use utf8;
-
-$|++;
-use lib '../lib';
-
-our $ft = 'auth.pl';
-
-my $t = Test::Mojo->new;
-
-my $app = $t->app;
-
-$app->mode('production');
-
-$app->plugin(Piwik => {
- url => 'sojolicio.us/piwik'
-});
-
-my $oo = $app->piwik_tag('opt-out');
-
-like($oo, qr{http://sojolicio\.us/}, 'Opt-Out');
-like($oo, qr{frameborder="no"}, 'Opt-Out');
-like($oo, qr{height="200px"}, 'Opt-Out');
-like($oo, qr{width="600px"}, 'Opt-Out');
-like($oo, qr{^<iframe}, 'Opt-Out');
-like($oo, qr{&amp;}, 'Opt-Out');
-
-$oo = $app->piwik_tag('opt-out', 'width' => '100%');
-
-like($oo, qr{http://sojolicio\.us/}, 'Opt-Out');
-like($oo, qr{frameborder="no"}, 'Opt-Out');
-like($oo, qr{height="200px"}, 'Opt-Out');
-like($oo, qr{width="100%"}, 'Opt-Out');
-like($oo, qr{^<iframe}, 'Opt-Out');
-like($oo, qr{&amp;}, 'Opt-Out');
-
-$oo = $app->piwik_tag('opt-out', 'frameborder' => 'yes');
-
-like($oo, qr{http://sojolicio\.us/}, 'Opt-Out');
-like($oo, qr{frameborder="yes"}, 'Opt-Out');
-like($oo, qr{height="200px"}, 'Opt-Out');
-like($oo, qr{width="600px"}, 'Opt-Out');
-like($oo, qr{^<iframe}, 'Opt-Out');
-like($oo, qr{&amp;}, 'Opt-Out');
-
-$oo = $app->piwik_tag('opt-out', 'frameborder' => 'yes' => sub { 'No iframes supported'});
-
-like($oo, qr{http://sojolicio\.us/}, 'Opt-Out');
-like($oo, qr{frameborder="yes"}, 'Opt-Out');
-like($oo, qr{height="200px"}, 'Opt-Out');
-like($oo, qr{width="600px"}, 'Opt-Out');
-like($oo, qr{^<iframe}, 'Opt-Out');
-like($oo, qr{>No iframes supported<}, 'Opt-Out');
-like($oo, qr{&amp;}, 'Opt-Out');
-
-
-my $c = Mojolicious::Controller->new;
-
-$c->app($app);
-
-$c->req->url(Mojo::URL->new('http:/khm.li/Rapunzel'));
-
-$oo = $c->piwik_tag('opt-out');
-
-like($oo, qr{http://sojolicio\.us/}, 'Opt-Out');
-
-$c->req->url(Mojo::URL->new('https:/khm.li/Rapunzel'));
-
-$oo = $c->piwik_tag('opt-out');
-
-like($oo, qr{https://sojolicio\.us/}, 'Opt-Out');
-like($oo, qr{iframe}, 'Opt-Out');
-
-$oo = $c->piwik_tag('opt-out-link');
-
-like($oo, qr{href="https://sojolicio\.us/piwik/index\.php\?module=CoreAdminHome&amp;action=optOut}, 'opt-out-link');
-like($oo, qr{>Piwik Opt-Out<}, 'opt-out-link');
-like($oo, qr{rel="nofollow"}, 'opt-out-link');
-
-$oo = $c->piwik_tag('opt-out-link', sub { 'MyOptOut' });
-
-like($oo, qr{href="https://sojolicio\.us/piwik/index\.php\?module=CoreAdminHome&amp;action=optOut}, 'opt-out-link');
-like($oo, qr{>MyOptOut<}, 'opt-out-link');
-like($oo, qr{rel="nofollow"}, 'opt-out-link');
-
-$oo = $c->render_partial(inline => "<%= piwik_tag 'opt-out-link', begin %>Opt Out!<% end %>");
-
-like($oo, qr{<a href=".+" rel="nofollow">Opt Out!</a>}, 'opt-out-link');
-
-done_testing;
View
@@ -1,130 +0,0 @@
-#!/usr/bin/env perl
-use Test::Mojo;
-use Test::More;
-use Mojolicious::Lite;
-use Mojo::JSON;
-use utf8;
-
-$|++;
-use lib '../lib';
-
-our $ft = 'auth.pl';
-
-my $t = Test::Mojo->new;
-
-my $app = $t->app;
-
-$app->mode('production');
-
-$app->plugin(Piwik => {
- url => 'sojolicio.us/piwik'
-});
-
-my $c = Mojolicious::Controller->new;
-
-$c->app($app);
-
-$c->req->url(Mojo::URL->new('http:/khm.li/Rapunzel'));
-
-$c->app($app);
-for ($c->req->headers) {
- $_->user_agent('Firefox');
- $_->referrer('http://khm.li/');
-};
-
-my $track = $c->piwik_api(
- Track => {
- idsite => '4',
- api_test => 1,
- res => [1024, 768]
- });
-
-like($track, qr{idsite=4}, 'Tracking 1');
-like($track, qr{ua=Firefox}, 'Tracking 1');
-like($track, qr{rec=1}, 'Tracking 1');
-like($track, qr{urlref=http://khm\.li/}, 'Tracking 1');
-like($track, qr{res=1024x768}, 'Tracking 1');
-
-$c->app($app);
-for ($c->req->headers) {
- $_->user_agent('Mojo-Test');
- $_->referrer('http://khm.li/');
-};
-
-$track = $c->piwik_api(
- Track => {
- idsite => [qw/4 5 6/],
- api_test => 1,
- res => '1024x768',
- action_url => 'http://khm.li/Rapunzel',
- action_name => 'Märchen/Rapunzel'
- });
-
-like($track, qr{idsite=4}, 'Tracking 2');
-like($track, qr{ua=Mojo-Test}, 'Tracking 2');
-like($track, qr{rec=1}, 'Tracking 2');
-like($track, qr{urlref=http://khm\.li/}, 'Tracking 2');
-like($track, qr{url=http://khm\.li/Rapunzel}, 'Tracking 2');
-like($track, qr{action_name=M%C3%A4rchen/Rapunzel}, 'Tracking 2');
-like($track, qr{res=1024x768}, 'Tracking 2');
-
-# Do not track
-$c->req->headers->dnt(1);
-
-$track = $c->piwik_api(
- Track => {
- idsite => [qw/4 5 6/],
- api_test => 1,
- res => '1024x768',
- action_url => 'http://khm.li/Rapunzel',
- action_name => 'Märchen/Rapunzel'
- });
-
-ok(!$track, 'Do not track');
-
-# Life tests:
-# Testing the piwik api is hard to do ...
-my (%param, $f);
-if (
- -f ($f = 't/' . $ft) ||
- -f ($f = $ft) ||
- -f ($f = '../t/' . $ft) ||
- -f ($f = '../../t/' . $ft)
- ) {
- if (open (CFG, '<' . $f)) {
- my $cfg = join('', <CFG>);
- close(CFG);
- %param = %{ eval $cfg };
- };
-};
-
-unless ($param{url}) {
- done_testing;
- exit;
-};
-
-$track = $c->piwik_api(
- Track => {
- idsite => [qw/4 5 6/],
- res => '1024x768',
- action_url => 'http://khm.li/Test',
- action_name => 'Märchen/Test',
- %param
-});
-
-ok(!$track, 'Do not track');
-
-$c->req->headers->dnt(0);
-
-$track = $c->piwik_api(
- Track => {
- res => '1024x768',
- %param
-});
-
-ok(!$track->{error}, 'No error');
-ok($track->{image}, 'Image');
-like($track->{image}, qr{base64}, 'Image');
-like($track->{image}, qr{image/gif}, 'Image');
-
-done_testing;
Oops, something went wrong.

0 comments on commit 0858262

Please sign in to comment.