Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Finished tests

* Will add more in the future if needed
* Prep for release to CPAN
  • Loading branch information...
commit ca1903e957ee3b5ea879f81d3d8dbe89a3e40a89 1 parent 21b0539
Mark Allen authored
8 Build.PL
View
@@ -9,16 +9,16 @@ my $builder = Module::Build->new(
dist_version_from => 'lib/Net/API/Gett.pm',
build_requires => {
'Test::More' => 0,
+ },
+ requires => {
+ 'perl' => 5.010,
+ 'LWP::Protocol::https' => 0,
'Moo' => 0,
'Sub::Quote' => 0,
'LWP' => 0,
'JSON' => 0,
'File::Slurp' => 0,
},
- requires => {
- 'perl' => 5.010,
- 'LWP::Protocol::https' => 0,
- },
add_to_cleanup => [ 'Net-API-Gett-*' ],
create_makefile_pl => 'traditional',
);
3  MANIFEST
View
@@ -5,9 +5,10 @@ lib/Net/API/Gett/User.pm
lib/Net/API/Gett/Share.pm
lib/Net/API/Gett/File.pm
MANIFEST This list of files
+MANIFEST.SKIP
README
+ignore.txt
t/00-load.t
t/01-basic.t
-t/02-author.t
t/manifest.t
t/pod.t
1  MANIFEST.SKIP
View
@@ -0,0 +1 @@
+.git
1  ignore.txt
View
@@ -10,3 +10,4 @@ pm_to_blib*
cover_db
pod2htm*.tmp
Net-API-Gett-*
+.git*
48 t/01-basic.t
View
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More;
+
+if (!eval { require Socket; Socket::inet_aton('open.ge.tt') }) {
+ plan skip_all => "Cannot connect to the API server";
+}
+else {
+ plan tests => 12;
+}
+
+use Net::API::Gett;
+
+# doesn't require auth
+# get_share()
+# get_file()
+# get_file_content()
+
+my $gett = Net::API::Gett->new(
+ api_key => "fake",
+ email => 'me@example.com',
+ password => 'fake',
+);
+
+isa_ok($gett, 'Net::API::Gett', "Gett object constructed");
+
+my $share = $gett->get_share("928PBdA");
+
+isa_ok($share, 'Net::API::Gett::Share', "share object constructed");
+
+is($share->sharename, "928PBdA", "got share name");
+is($share->created, "1322847473", "got share created");
+like($share->title, qr/Test/, "got share title");
+is(scalar $share->files, 2, "got 2 files");
+
+my $file = $gett->get_file("928PBdA", 0); #hello.c
+
+isa_ok($file, 'Net::API::Gett::File', "file object constructed");
+
+is($file->created, 1322847473, "got file created");
+is($file->fileid, 0, "got fileid");
+is($file->filename, "hello.c", "got filename");
+
+my $contents = $gett->get_file_contents("928PBdA", 0);
+
+like($contents, qr/Hello world/, "Got hello.c content");
+is(length($contents), $file->size, "file content size matches file object");
56 t/boilerplate.t
View
@@ -1,56 +0,0 @@
-#!perl -T
-
-use 5.006;
-use strict;
-use warnings;
-use Test::More tests => 3;
-
-sub not_in_file_ok {
- my ($filename, %regex) = @_;
- open( my $fh, '<', $filename )
- or die "couldn't open $filename for reading: $!";
-
- my %violated;
-
- while (my $line = <$fh>) {
- while (my ($desc, $regex) = each %regex) {
- if ($line =~ $regex) {
- push @{$violated{$desc}||=[]}, $.;
- }
- }
- }
-
- if (%violated) {
- fail("$filename contains boilerplate text");
- diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
- } else {
- pass("$filename contains no boilerplate text");
- }
-}
-
-sub module_boilerplate_ok {
- my ($module) = @_;
- not_in_file_ok($module =>
- 'the great new $MODULENAME' => qr/ - The great new /,
- 'boilerplate description' => qr/Quick summary of what the module/,
- 'stub function definition' => qr/function[12]/,
- );
-}
-
-TODO: {
- local $TODO = "Need to replace the boilerplate text";
-
- not_in_file_ok(README =>
- "The README is used..." => qr/The README is used/,
- "'version information here'" => qr/to provide version information/,
- );
-
- not_in_file_ok(Changes =>
- "placeholder date/time" => qr(Date/time)
- );
-
- module_boilerplate_ok('lib/Net/API/Gett.pm');
-
-
-}
-
Please sign in to comment.
Something went wrong with that request. Please try again.