def test_group_has_no_dependents(group_dep_mocks): group = BrandGroup() has = group.has_dependents() assert has is False for m in list(group_dep_mocks.values()): m.return_value.exists.assert_called_once_with()
def test_brand_group_stat_counts(): with mock.patch('%s.BrandGroup.active_issues' % PATH) as is_mock, \ mock.patch('%s.BrandGroup.active_emblems' % PATH) as em_mock: is_mock.return_value.exists.return_value = True em_mock.return_value.count.return_value = 42 counts = BrandGroup().stat_counts() assert counts == {'brands': 1} with mock.patch('%s.BrandGroup.active_issues' % PATH) as is_mock, \ mock.patch('%s.BrandGroup.active_emblems' % PATH) as em_mock: is_mock.return_value.exists.return_value = False em_mock.return_value.count.return_value = 42 counts = BrandGroup().stat_counts() assert counts == {'brands': 1}
def test_group_has_dependents_issue_count(group_dep_mocks): group = BrandGroup(issue_count=1) has = group.has_dependents() assert has is True
def test_group_has_dependents_revs_exist(group_dep_mocks, which_exists): group_dep_mocks[which_exists].return_value.exists.return_value = True group = BrandGroup() has = group.has_dependents() assert has is True