aboutsummaryrefslogtreecommitdiffstats
path: root/t/Facebook.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-01-27 11:38:11 +0000
committerMatthew Somerville <matthew@mysociety.org>2016-01-27 11:38:11 +0000
commit2679b30e530861ba7c2bef6f36a60242872bd6a7 (patch)
tree7cec1bc797b30f7efb8b4eae0549bcebd1c96e07 /t/Facebook.pm
parentb8083a462aebf542f6f39c4201e1f09248b7e0e7 (diff)
Move test mocks to their own directory.
Diffstat (limited to 't/Facebook.pm')
-rw-r--r--t/Facebook.pm52
1 files changed, 0 insertions, 52 deletions
diff --git a/t/Facebook.pm b/t/Facebook.pm
deleted file mode 100644
index 8c258699b..000000000
--- a/t/Facebook.pm
+++ /dev/null
@@ -1,52 +0,0 @@
-package t::Facebook;
-
-use JSON;
-use Web::Simple;
-use MooX::Types::MooseLike::Base qw(:all);
-
-has json => (
- is => 'lazy',
- default => sub {
- JSON->new->pretty->allow_blessed->convert_blessed;
- },
-);
-
-has returns_email => (
- is => 'rw',
- isa => Bool,
- default => 1,
-);
-
-sub dispatch_request {
- my $self = shift;
-
- sub (GET + /v2.2/dialog/oauth + ?*) {
- my ($self) = @_;
- return [ 200, [ 'Content-Type' => 'text/html' ], [ 'FB login page' ] ];
- },
-
- sub (GET + /v2.2/oauth/access_token + ?*) {
- my ($self) = @_;
- return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'access_token=access_token&expires=never' ] ];
- },
-
- sub (GET + /me + ?fields=) {
- my ($self, $fields) = @_;
- my $data = {
- id => '123456789',
- name => 'Fiona Tester',
- };
- $data->{email} = 'facebook@example.org' if $self->returns_email;
- my $json = $self->json->encode($data);
- return [ 200, [ 'Content-Type' => 'text/html' ], [ $json ] ];
- },
-
- sub (GET + /search + ?q=) {
- my ($self, $q) = @_;
- my $response = $self->query($q);
- my $json = $self->json->encode($response);
- return [ 200, [ 'Content-Type' => 'application/json' ], [ $json ] ];
- },
-}
-
-__PACKAGE__->run_if_script;