-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes based on PR review + audit log
- Loading branch information
Showing
11 changed files
with
64 additions
and
46 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module AuditableApiEvents | ||
def log_api_call(action) | ||
EventBus.publish(action, request, response) | ||
end | ||
end |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1 @@ | ||
json.tenant_id @box.tenant_id | ||
json.id @box.id | ||
json.name @box.name | ||
json.uri @box.uri | ||
json.short_name @box.short_name | ||
json.color @box.color | ||
json.api_connection_id @box.api_connection_id |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
json.message @error || @box.errors.full_messages[0] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1 @@ | ||
json.id @tenant.id | ||
json.name @tenant.name | ||
json.feature_flags @tenant.feature_flags | ||
json.admin do | ||
json.id @admin.id | ||
json.name @admin.name | ||
json.email @admin.email | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
json.message @error || | ||
@tenant.errors.full_messages[0] || | ||
@admin.errors.full_messages[0] || | ||
@group_membership.errors.full_messages[0] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,16 @@ | |
|
||
class TenantApiTest < ActionDispatch::IntegrationTest | ||
test "can create tenant" do | ||
post "/api/admin/tenants", params: { tenant: { name: "Testovaci tenant" }, admin: { name: "Testovaci admin", email: "[email protected]" } }, as: :json | ||
post "/api/admin/tenants", params: { tenant: { name: "Testovaci tenant", admin: { name: "Testovaci admin", email: "[email protected]" } } }, as: :json | ||
assert_response :success | ||
json_response = JSON.parse(response.body) | ||
assert_equal "Testovaci tenant", json_response["name"] | ||
assert_not_nil json_response["id"] | ||
assert_empty json_response["feature_flags"] | ||
assert Tenant.exists?(json_response["id"]) | ||
assert Tenant.find(json_response["id"]).admin_group.users.first.name, "Testovaci admin" | ||
assert Tenant.find(json_response["id"]).admin_group.users.first.email, "[email protected]" | ||
tenant = Tenant.find(json_response["id"]) | ||
assert_empty tenant.feature_flags | ||
assert_equal "Testovaci tenant", tenant.name | ||
assert tenant.admin_group.users.first.name, "Testovaci admin" | ||
assert tenant.admin_group.users.first.email, "[email protected]" | ||
end | ||
|
||
test "can destroy tenant" do | ||
|
@@ -26,6 +27,9 @@ class TenantApiTest < ActionDispatch::IntegrationTest | |
post "/api/admin/tenants/#{tenant.id}/boxes", params: { box: { name: "Test box", uri: "ico://sk//12345678", short_name: "TST", color: "blue", api_connection_id: api_connections(:govbox_api_api_connection1).id } }, as: :json | ||
assert_response :success | ||
json_response = JSON.parse(response.body) | ||
assert_equal "Test box", json_response["name"] | ||
box = tenant.boxes.find_by(name: "Test box") | ||
assert box | ||
assert json_response["id"] | ||
assert_equal json_response["id"], box.id | ||
end | ||
end |
Toto sme sa zatial dohodli, ze neriesime. pls focus na surove api biznisove.