Last active
November 9, 2015 01:45
-
-
Save smangelsdorf/06576472ae1d47dedff6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shaun@macaroon ~/Projects/reporting-service (feature/federation-growth-report*)$ rspec | |
Run options: include {:focus=>true} | |
All examples were filtered out; ignoring {:focus=>true} | |
Randomized with seed 47069 | |
FederationGrowthReport | |
growth report generate | |
includes unique activations only | |
does not include dublicate activations | |
includes title, units, lables and range | |
ApplicationController | |
AAF shared implementation | |
#ensure_authenticated as before_action | |
Subject that is not functioning | |
resets the session | |
should render template matcher "errors/unauthorized" | |
should respond with status code :unauthorized (401) | |
No subject ID is set in session | |
should respond with a redirect status code (3xx) | |
should redirect to "/auth/login" | |
session has subject_id that does not represent a Subject | |
should render template matcher "errors/unauthorized" | |
should respond with status code :unauthorized (401) | |
resets the session | |
#ensure_access_checked as after_action | |
subject without permissions | |
fails request to incorrectly implemented action | |
has no permissions | |
completes request to a public action | |
the request does not complete | |
renders forbidden template | |
should respond with status code :forbidden (403) | |
subject with valid permission | |
completes request to a public action | |
fails request to incorrectly implemented action | |
completes request after permissions checked | |
has a valid permission | |
subject with invalid permissions | |
completes request to a public action | |
has an invalid permission | |
fails request to incorrectly implemented action | |
the request does not complete | |
renders forbidden template | |
should respond with status code :forbidden (403) | |
#subject | |
Subject that is not functioning | |
returns nil | |
session has subject_id that does not represent a Subject | |
returns nil | |
Subject is valid | |
returns subject | |
No subject ID is set in session | |
returns nil | |
APISubject | |
permissions | |
super admin | |
should be permitted "admin:subjects:list" | |
specific permission | |
should be permitted "a:b:c" | |
should not be permitted "a:b" | |
AAF shared implementation | |
should respond to #permits? | |
is invalid without a contact name | |
should respond to #functioning? | |
should respond to #roles | |
should be valid | |
is invalid without an enabled state | |
is invalid without a description | |
is invalid without a contact mail address | |
should be a kind of Accession::Principal | |
should respond to #permissions | |
is invalid without an x509_cn | |
Subject | |
#entitlements= | |
when an entitlement is removed | |
removes the role | |
when the role exists | |
assigns the role to the subject | |
does not create a role | |
when the role is already assigned | |
makes no change | |
when the role does not exist | |
creates the role | |
assigns the new role to the subject | |
permissions | |
specific permission | |
should not be permitted "a:b" | |
should be permitted "a:b:c" | |
super admin | |
should be permitted "admin:subjects:list" | |
AAF shared implementation | |
is invalid without mail | |
should respond to #permits? | |
is invalid without a complete state | |
should respond to #permissions | |
should respond to #roles | |
should be a kind of Accession::Principal | |
should respond to #functioning? | |
is invalid without a name | |
should be valid | |
is invalid without an enabled state | |
TabularReport | |
#generate | |
should include {:title => "Hic quaerat tempore unde."} | |
should include {:rows => [["dignissimos", "quae", "ullam"], ["nihil", "est", "sint"], ["repellat", "omnis", "et"], ["sint", "eum", "non"], ["esse", "eum", "dolor"], ["voluptatem", "ipsam", "qui"], ["voluptatibus", "porro", "quia"], ["rem", "soluta", "corrupti"], ["nesciunt", "nihil", "esse"], ["sint", "commodi", "porro"]]} | |
should include {:type => "test-table"} | |
should include {:header => [["Column 1", "Column 2", "Column 3"]]} | |
should include {:footer => [["Footer 1", "Footer 2", "Footer 3"]]} | |
::options | |
when subclassed | |
overrides options in the build | |
has a separate options hash | |
Authentication::SubjectReceiver | |
#subject | |
with an existing subject | |
updates roles for the subject | |
marks the subject as complete | |
returns the existing subject | |
updates the attributes | |
with a mismatched targeted id | |
fails to provision the subject | |
with a mismatched shared token | |
fails to provision the subject | |
for an unknown subject | |
creates the subject | |
returns the new subject | |
marks the new subject as complete | |
updates roles for the subject | |
#map_attributes | |
maps the attributes | |
ServiceProvider | |
validations | |
should require entity_id to be set | |
should require name to be set | |
API::APIController | |
AAF shared implementation | |
should respond to #subject | |
#ensure_authenticated as before_action | |
with a CN that does not represent an APISubject | |
should respond with status code :unauthorized (401) | |
json within response | |
has a message | |
has an error | |
no x509 header set by nginx | |
should respond with status code :unauthorized (401) | |
json within response | |
has a message | |
has an error | |
with an APISubject that is not functioning | |
should respond with status code :unauthorized (401) | |
json within response | |
has a message | |
has an error | |
invalid x509 header set by nginx | |
should respond with status code :unauthorized (401) | |
json within response | |
has a message | |
has an error | |
without a CN component to DN | |
should respond with status code :unauthorized (401) | |
json within response | |
has a message | |
has an error | |
#ensure_access_checked as after_action | |
subject with invalid permissions | |
completes request to a public action | |
fails request to incorrectly implemented action | |
has an invalid permission | |
the request does not complete | |
should respond with status code :forbidden (403) | |
recieves a json message | |
subject with valid permission | |
completes request after permissions checked | |
has a valid permission | |
completes request to a public action | |
fails request to incorrectly implemented action | |
subject without permissions | |
has no permissions | |
fails request to incorrectly implemented action | |
completes request to a public action | |
the request does not complete | |
recieves a json message | |
should respond with status code :forbidden (403) | |
RapidConnectService | |
validations | |
should require case sensitive unique value for identifier | |
should require name to be set | |
should require service_type to be set | |
should require identifier to be set | |
Activation | |
validations | |
should require federation_object to be set | |
should not require deactivated_at to be set | |
should require activated_at to be set | |
Permission | |
AAF shared implementation | |
allows permission string values | |
can have a value used in a different role | |
is invalid without a role | |
allows wildcard values | |
is invalid without a value | |
disallows invalid characters | |
should be valid | |
must have a unique value per role | |
ApplicationHelper | |
#permitted? | |
returns false when not permitted | |
returns true when permitted | |
with no user | |
returns false | |
#environment_string | |
returns the configured string | |
IdentityProvider | |
validations | |
should require entity_id to be set | |
should require name to be set | |
should require case sensitive unique value for entity_id | |
SAMLAttribute | |
validations | |
should require description to be set | |
should require case sensitive unique value for name | |
should require name to be set | |
APIConstraints | |
AAF shared implementation | |
#matches? | |
with default: true | |
is true for a non-matching request | |
is true for a valid request | |
with default: false | |
is false for a non-matching request | |
is true for a valid request | |
ServiceProviderSAMLAttribute | |
validations | |
should require service_provider to be set | |
should require saml_attribute to be set | |
TabularReport::Lint | |
when the header is an array of strings | |
fails with the message 'header must be an array of arrays' | |
for valid output | |
returns the output | |
when the header is missing | |
fails with the message 'header is nil' | |
when the header is blank | |
fails with the message 'header is blank' | |
when the row data is missing | |
fails with the message 'rows is nil' | |
when the footer is blank | |
is valid | |
when the row data is an array of strings | |
fails with the message 'row data must be an array of arrays' | |
when the header contains non-string data | |
fails with the message 'header fields must be strings' | |
with nil output | |
fails with the message 'output is blank' | |
when the footer is an array of strings | |
fails with the message 'footer must be an array of arrays' | |
when the footer is missing | |
fails with the message 'footer is nil' | |
when the rows contain non-string data | |
fails with the message 'row data fields must be strings' | |
when the row data is blank | |
is valid | |
when the header has too few items | |
fails with the message 'row data has inconsistent width' | |
when the footer contains non-string data | |
fails with the message 'footer fields must be strings' | |
when the rows differ in length | |
fails with the message 'row data has inconsistent width' | |
when the footer has too few items | |
fails with the message 'footer size is incorrect' | |
TimeSeriesReport | |
#generate | |
should include {:labels => (include {:b => "The letter B"})} | |
should include {:range => {:start => 2015-11-02 00:00:00 UTC, :end => 2015-11-09 00:00:00 UTC}} | |
should include {:series => (contain exactly :a, :b, and :c)} | |
should include {:type => "test-report"} | |
should include {:title => "Excepturi perspiciatis ullam molestiae."} | |
should include {:labels => (include {:c => "The letter C"})} | |
should include {:units => " Hz"} | |
should include {:data => {:a => [[0, 0], [1, 0], [2, 0]], :b => [[0, 1], [1, 1], [2, 1]], :c => [[0, 2], [1, 2], [2, 2]]}} | |
should include {:labels => (include {:a => "The letter A"})} | |
should include {:labels => (include {:y => "Y Label"})} | |
::options | |
when subclassed | |
has a separate options hash | |
retains options from the parent | |
behaves predictably with nested options | |
Organization | |
validations | |
should require case sensitive unique value for identifier | |
should require name to be set | |
should require identifier to be set | |
TimeSeriesReport::Lint | |
when the start time is a Time object | |
fails with the message 'start of time range is invalid' | |
when extra series data is present | |
fails with the message 'extra data present for series_d' | |
with no data | |
fails with the message 'data is nil' | |
with blank type | |
fails with the message 'type is blank' | |
with incorrect type for range | |
fails with the message 'incorrect type for range' | |
when a label is not a string | |
fails with the message 'label for series_a is not a String' | |
with no type | |
fails with the message 'type is nil' | |
when the range is missing an end time | |
fails with the message 'time range is missing end' | |
with no range | |
fails with the message 'range is nil' | |
when units are blank | |
is valid | |
when data for a series is missing | |
fails with the message 'missing data for series_a' | |
with nil output | |
fails with the message 'output is blank' | |
with incorrect type for labels | |
fails with the message 'incorrect type for labels' | |
when the end time is invalid | |
fails with the message 'end of time range is invalid' | |
when the range is missing a start time | |
fails with the message 'time range is missing start' | |
when the start time is invalid | |
fails with the message 'start of time range is invalid' | |
with blank labels | |
fails with the message 'labels is blank' | |
when the data exceeds the end of the time range | |
fails with the message 'data for series_a is outside time range' | |
with incorrect type for type | |
fails with the message 'incorrect type for type' | |
with no title | |
fails with the message 'title is nil' | |
when a series is named "y" | |
fails with the message 'series name "y" is not permitted' | |
with blank title | |
fails with the message 'title is blank' | |
when the end time is a Time object | |
fails with the message 'end of time range is invalid' | |
with incorrect type for series | |
fails with the message 'incorrect type for series' | |
with no series | |
fails with the message 'series is nil' | |
with blank range | |
fails with the message 'range is blank' | |
with no labels | |
fails with the message 'labels is nil' | |
with blank series | |
fails with the message 'series is blank' | |
when the data is empty | |
fails with the message 'data for series_a is blank' | |
when a label is missing | |
fails with the message 'missing label for series_c' | |
when the y axis label is missing | |
fails with the message 'missing label for y axis' | |
with incorrect type for title | |
fails with the message 'incorrect type for title' | |
when a data point is non-numeric | |
fails with the message 'data for series_a is not numeric' | |
when the data is unsorted | |
fails with the message 'data for series_a is unsorted' | |
when the data precedes the start of the time range | |
fails with the message 'data for series_a is outside time range' | |
with blank data | |
fails with the message 'data is blank' | |
when an extra label is present | |
fails with the message 'extra label present for series_d' | |
for valid output | |
returns the output | |
when units are missing | |
fails with the message 'units is nil' | |
with incorrect type for data | |
fails with the message 'incorrect type for data' | |
WelcomeController | |
#index | |
should respond with status code :ok (200) | |
should render template matcher "welcome/index" | |
when authenticated | |
should redirect to "/dashboard" | |
Role | |
::for_entitlement | |
when the role exists | |
should not change #count | |
returns the existing role | |
updates the permissions | |
when the role does not exist | |
should change #count by 1 | |
returns the new role | |
updates the permissions | |
AAF shared implementation | |
should respond to #subjects | |
should be valid | |
is invalid without a name | |
should respond to #permissions | |
should respond to #api_subjects | |
#update_permissions | |
for an admin entitlement | |
creates no duplicate permissions | |
removes non-superuser permissions | |
creates a superuser permission | |
for a federation object entitlement | |
removes extra permissions | |
creates the object permission | |
creates no duplicate permissions | |
for an unrecognised entitlement | |
removes all permissions | |
creates no permissions | |
for a federation object admin entitlement | |
creates no duplicate permissions | |
creates the object admin permission | |
removes extra permissions | |
DashboardController | |
#index | |
should redirect to "/auth/login" | |
when authenticated | |
should render template matcher "dashboard/index" | |
should respond with status code :ok (200) | |
Authentication::IdentityEnhancement | |
#update_roles | |
with no attributes returned from IdE | |
removes the role from the subject | |
with a 404 response from IdE | |
removes entitlements from the subject | |
with a successful response from IdE | |
when the role exists | |
assigns the existing role to the Subject | |
when the role does not exist | |
assigns a new role to the Subject | |
with additional attributes | |
ignores the extra attribute | |
with an error response from IdE | |
raises the error | |
SubscriberRegistrationReport | |
report generation | |
for an Identity Provider | |
behaves like a report which lists federation objects | |
produces title, header and type | |
returns an array | |
when all objects are deactivated | |
excludes all objects | |
when objects have no activations | |
excludes object without activations | |
when all objects are activated | |
includes reported objects | |
for a Rapid Connect Service | |
behaves like a report which lists federation objects | |
returns an array | |
produces title, header and type | |
when all objects are activated | |
includes reported objects | |
when objects have no activations | |
excludes object without activations | |
when all objects are deactivated | |
excludes all objects | |
for an Organization | |
behaves like a report which lists federation objects | |
returns an array | |
produces title, header and type | |
when all objects are deactivated | |
excludes all objects | |
when all objects are activated | |
includes reported objects | |
when objects have no activations | |
excludes object without activations | |
for a Service | |
behaves like a report which lists federation objects | |
produces title, header and type | |
returns an array | |
when all objects are activated | |
includes reported objects | |
when all objects are deactivated | |
excludes all objects | |
when objects have no activations | |
excludes object without activations | |
for a Service Provider | |
behaves like a report which lists federation objects | |
produces title, header and type | |
returns an array | |
when all objects are activated | |
includes reported objects | |
when all objects are deactivated | |
excludes all objects | |
when objects have no activations | |
excludes object without activations | |
IdentityProviderSAMLAttribute | |
validations | |
requires the attribute to be unique per IdP | |
should require saml_attribute to be set | |
should require identity_provider to be set | |
Finished in 3.38 seconds (files took 4 seconds to load) | |
278 examples, 0 failures | |
Randomized with seed 47069 | |
Coverage report generated for RSpec to /Users/shaun/Projects/reporting-service/coverage. 440 / 440 LOC (100.0%) covered. | |
shaun@macaroon ~/Projects/reporting-service (feature/federation-growth-report*)$ cat app/reports/federation_growth_report.rb | |
class FederationGrowthReport < TimeSeriesReport | |
report_type 'federation-growth-report' | |
y_label '' | |
series organizations: 'Organizations', | |
identity_providers: 'Identity Providers', | |
rapid_connect_services: 'Rapid Connect Services' | |
units '' | |
def initialize(title, start, finish) | |
super(title, start, finish) | |
@start = start | |
@finish = finish | |
end | |
private | |
def data | |
a = Activation.all | |
{ organizations: [[0, a.map(&:federation_object_id).uniq.count]], | |
identity_providers: [[0, 0]], rapid_connect_services: [[0, 0]] } | |
end | |
end | |
shaun@macaroon ~/Projects/reporting-service (feature/federation-growth-report*)$ git show | |
commit bd8c4f14c3a18a1339144422bc7d75ff64d0198c | |
Author: toomaj <[email protected]> | |
Date: Fri Nov 6 14:46:01 2015 +1000 | |
Fix a dublicated example | |
diff --git a/spec/reports/federation_growth_report_spec.rb b/spec/reports/federation_growth_report_spec.rb | |
index fce260a..325d4ed 100644 | |
--- a/spec/reports/federation_growth_report_spec.rb | |
+++ b/spec/reports/federation_growth_report_spec.rb | |
@@ -42,7 +42,7 @@ RSpec.describe FederationGrowthReport do | |
it 'does not include dublicate activations' do | |
expect(subject.generate) | |
- .to include(data: (include organizations: include([0, 1]))) | |
+ .not_to include(data: (include organizations: include([0, 2]))) | |
end | |
end | |
end | |
shaun@macaroon ~/Projects/reporting-service (feature/federation-growth-report*)$ git status | |
On branch feature/federation-growth-report | |
Your branch is up-to-date with 'origin/feature/federation-growth-report'. | |
Changes not staged for commit: | |
(use "git add <file>..." to update what will be committed) | |
(use "git checkout -- <file>..." to discard changes in working directory) | |
modified: app/reports/federation_growth_report.rb | |
Untracked files: | |
(use "git add <file>..." to include in what will be committed) | |
app/views/admin/ | |
model.md | |
roles.md | |
no changes added to commit (use "git add" and/or "git commit -a") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment