Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata filter scenarios #262

Merged
merged 1 commit into from
Mar 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions features/auto_filter.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Feature: Android support

Scenario: Automatic Filter Tracking
When I run "AutoFilterScenario" with the defaults
Then I should receive a request
And the request is a valid for the error reporting API
And the "Bugsnag-API-Key" header equals "a35a2a72bd230ac0aa0f52715bbdc6aa"
And the exception "message" equals "AutoFilterScenario"
And the event "metaData.custom.foo" equals "hunter2"
And the event "metaData.custom.password" equals "[FILTERED]"
And the event "metaData.user.password" equals "[FILTERED]"
11 changes: 11 additions & 0 deletions features/manual_filter.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Feature: Android support

Scenario: Manual Filter Tracking
When I run "ManualFilterScenario" with the defaults
Then I should receive a request
And the request is a valid for the error reporting API
And the "Bugsnag-API-Key" header equals "a35a2a72bd230ac0aa0f52715bbdc6aa"
And the exception "message" equals "ManualFilterScenario"
And the event "metaData.custom.foo" equals "[FILTERED]"
And the event "metaData.user.foo" equals "[FILTERED]"
And the event "metaData.custom.bar" equals "hunter2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.bugsnag.android.mazerunner.scenarios

import android.content.Context
import com.bugsnag.android.Bugsnag
import com.bugsnag.android.Configuration

/**
* Sends a handled exception to Bugsnag, which contains metadata that should be filtered
*/
internal class AutoFilterScenario(config: Configuration,
context: Context) : Scenario(config, context) {

override fun run() {
super.run()
Bugsnag.addToTab("user", "password", "hunter2")
Bugsnag.addToTab("custom", "password", "hunter2")
Bugsnag.addToTab("custom", "foo", "hunter2")
Bugsnag.notify(generateException())
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.bugsnag.android.mazerunner.scenarios

import android.content.Context
import com.bugsnag.android.Bugsnag
import com.bugsnag.android.Configuration

/**
* Sends a handled exception to Bugsnag, which contains metadata that should be filtered
*/
internal class ManualFilterScenario(config: Configuration,
context: Context) : Scenario(config, context) {

override fun run() {
super.run()
Bugsnag.setFilters("foo")
Bugsnag.addToTab("user", "foo", "hunter2")
Bugsnag.addToTab("custom", "foo", "hunter2")
Bugsnag.addToTab("custom", "bar", "hunter2")
Bugsnag.notify(generateException())
}

}