Permalink
Browse files

Setup wasapi_files_helper_test (#87)

- Add test
- Update test fixtures for collections, and wasapi_files
- Add codecov config
  • Loading branch information...
ruebot authored and ianmilligan1 committed Mar 28, 2018
1 parent 71fa23c commit d2b775aae78bce26c8c6086de44201a228b0e54f
Showing with 71 additions and 30 deletions.
  1. +11 −0 .codecov.yml
  2. +10 −6 test/fixtures/collections.yml
  3. +26 −24 test/fixtures/wasapi_files.yml
  4. +24 −0 test/helpers/wasapi_files_helper_test.rb
@@ -0,0 +1,11 @@
codecov:
# Default branch for CodeCov information
branch: master

coverage:
status:
project:
default:
# Only against master
branches:
- master
@@ -1,11 +1,15 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
collection_id: 1
title: MyString
public: false
collection_id: 1234
title: "Sample Collection"
public: true
account: 401
user_id: 1

two:
collection_id: 1
title: MyString
public: false
collection_id: 3490
title: "Archives Unleashed"
public: true
account: 401
user_id: 2
@@ -1,29 +1,31 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
checksum_md5: MyString
checksum_sha1: MyString
filetype: MyString
size: 2388654180
filename: MyString
crawl_time: MyString
crawl_start: MyString
crawl: 1
account: 1
collection_id: 1
location_archive_it: MyString
location_internet_archive: MyString
checksum_md5: "8693c4cfc362a6ccefaef2e88d62434b"
checksum_sha1: "164741182aace03f84d71fda90f1cca689e3e7ce"
filetype: "warc"
size: 193433
filename: "ARCHIVEIT-3490-TWELVE_HOURS-7344-20130425153604106-00000-wbgrp-crawl102.us.archive.org-6443.warc.gz"
crawl_time: "2013-04-25T15:36:04Z"
crawl_start: "2013-04-25T15:36:00Z"
crawl: 69284
account: 401
collection_id: 3490
location_archive_it: "https://warcs.archive-it.org/webdatafile/ARCHIVEIT-3490-TWELVE_HOURS-7344-20130425153604106-00000-wbgrp-crawl102.us.archive.org-6443.warc.gz"
location_internet_archive: "https://archive.org/download/ARCHIVEIT-3490-TWELVE_HOURS-7344-00000/ARCHIVEIT-3490-TWELVE_HOURS-7344-20130425153604106-00000-wbgrp-crawl102.us.archive.org-6443.warc.gz"
user_id: 2

two:
checksum_md5: MyString
checksum_sha1: MyString
filetype: MyString
size: 2388654180
filename: MyString
crawl_time: MyString
crawl_start: MyString
crawl: 1
account: 1
collection_id: 1
location_archive_it: MyString
location_internet_archive: MyString
checksum_md5: "6875c6567c9de300233f8c541d967f38"
checksum_sha1: "c371a8faf1387f1ae81fd5de6914d6864760c063"
filetype: "warc"
size: 472635
filename: "ARCHIVEIT-3490-TWELVE_HOURS-7309-20130429033607153-00000-wbgrp-crawl057.us.archive.org-6443.warc.gz"
crawl_time: "2013-04-29T03:36:07Z"
crawl_start: ""
crawl: 69287
account: 401
collection_id: 3490
location_archive_it: "https://warcs.archive-it.org/webdatafile/ARCHIVEIT-3490-TWELVE_HOURS-7309-20130429033607153-00000-wbgrp-crawl057.us.archive.org-6443.warc.gz"
location_internet_archive: "https://archive.org/download/ARCHIVEIT-3490-TWELVE_HOURS-7309-00000/ARCHIVEIT-3490-TWELVE_HOURS-7309-20130429033607153-00000-wbgrp-crawl057.us.archive.org-6443.warc.gz"
user_id: 2
@@ -0,0 +1,24 @@
# frozen_string_literal: true

require 'test_helper'

class WasapiFilesHelperTest < ActionView::TestCase
def setup
@wasapi_files_one = wasapi_files(:one)
@wasapi_files_two = wasapi_files(:two)
end

test 'collection count helper' do
assert_equal 2, collection_count(@wasapi_files_one.collection_id,
@wasapi_files_one.user_id)
assert_equal 2, collection_count(@wasapi_files_two.collection_id,
@wasapi_files_two.user_id)
end

test 'collection size helper' do
assert_equal '650 KB', collection_size(@wasapi_files_one.collection_id,
@wasapi_files_one.user_id)
assert_equal '650 KB', collection_size(@wasapi_files_two.collection_id,
@wasapi_files_two.user_id)
end
end

0 comments on commit d2b775a

Please sign in to comment.