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

Refs #23676 - Robottelo tests attr - content_view #7527

Merged
merged 2 commits into from Aug 22, 2018

Conversation

ldjebran
Copy link
Contributor

Related robottelo issues:
SatelliteQE/robottelo#6125
SatelliteQE/robottelo#5843

Update to PR: #7395

Port robottelo tier1 tests for organization part of robottelo minitest port project: https://github.com/SatelliteQE/robottelo/projects/1

@theforeman-bot
Copy link

Issues: #23676

@ehelms
Copy link
Member

ehelms commented Jul 16, 2018

[test katello/webpack]

Copy link
Member

@akofink akofink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some duplicates here.

@@ -179,6 +189,13 @@ def test_update_protected
end
end

test_attributes :pid => '69a2ce8d-19b2-49a3-97db-a1fdebbb16be'
def test_should_not_update_with_invalid_name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer test_should_not_update_with_empty_name, which is more precise.

@@ -91,6 +93,13 @@ def test_create_fail_without_organization_id
assert_response :not_found
end

test_attributes :pid => '261376ca-7d12-41b6-9c36-5f284865243e'
def test_should_not_create_with_invalid_name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer test_should_not_create_with_empty_name, which is more precise.

test_attributes :pid => '4a3b616d-53ab-4396-9a50-916d6c42a401'
def test_should_create_composite
view = ContentView.new(:name => "new content view", :organization_id => @organization.id)
[false, true].each do |composite|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why test non-composite here? I'd opt for testing only composite, since we test normal CV creating on L80 test_create_with_name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akofink we need to trigger both property values for this test, we have to be sure that we are able to create with with true false values.

Copy link
Contributor Author

@ldjebran ldjebran Jul 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akofink this test test cost nothing in terms of time, as it does create a real entity, but informative on the reason of failure (in case it fail)

Copy link
Member

@akofink akofink Jul 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test test cost nothing in terms of time

All the tests have some time cost associated, even if it doesn't hit the DB. Ensuring we don't test the same thing twice isn't pertinent, but it's ideal. Since L80 is testing composite: nil (i.e. default) instead of composite: false, I guess this is fine.

view = ContentView.create!(:name => "org content view", :organization_id => @organization.id)
valid_name_list.each do |name|
view.name = name
assert view.valid?, "Validation failed for content view update with valid name: '#{name}', length: #{name}"
Copy link
Member

@akofink akofink Jul 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tested on L66 with should_not allow_values(*invalid_name_list).for(:name).

Copy link
Contributor Author

@ldjebran ldjebran Jul 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akofink should_not allow_values this is a negative test, but here we are covering a positive test scenario

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to test valid_name_list names are accepted here, then at least, let's not test them all in other places (i.e. L227).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akofink in L227 we are testing description field with variation values using name list

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name and description validations in the controller have no dependencies - they're both validated individually. You should either be testing the name field validations or the description validations, not both. These are unit tests after all!

end

test_attributes :pid => '77883887-800f-412f-91a3-b2f7ed999c70'
def test_should_not_update_label
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is covered on L108 test_bad_label.

Copy link
Contributor Author

@ldjebran ldjebran Jul 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akofink That test is testing the value of label that is not acceptable, here we are testing that label is immutable and cannot be changed even if the value is valid

@ldjebran ldjebran force-pushed the content_view_test_attributes branch from f09b408 to 8199b62 Compare July 25, 2018 10:04
@ldjebran
Copy link
Contributor Author

@akofink updated test names and rebased

@jlsherrill
Copy link
Member

@akofink mind re-reviewing?

Copy link
Member

@akofink akofink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. It's a bit overlapping IMO, but it doesn't hurt anything.

@akofink akofink merged commit e300ab9 into Katello:master Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants