mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 14:31:57 -05:00
Merge pull request #1265 from alphagov/logoless-organsations
Make organisation logo nullable
This commit is contained in:
@@ -21,20 +21,13 @@ def test_create_organisation(notify_db, notify_db_session):
|
||||
|
||||
|
||||
def test_create_organisation_without_name_or_colour_is_valid(notify_db, notify_db_session):
|
||||
organisation = create_organisation(name=None, colour=None)
|
||||
organisation = create_organisation(logo=None, name=None, colour=None)
|
||||
|
||||
assert Organisation.query.count() == 1
|
||||
organisation_from_db = Organisation.query.first()
|
||||
assert organisation == organisation_from_db
|
||||
|
||||
|
||||
def test_create_organisation_without_logo_raises_error(notify_db, notify_db_session):
|
||||
with pytest.raises(IntegrityError) as excinfo:
|
||||
create_organisation(logo=None)
|
||||
assert 'column "logo" violates not-null constraint' in str(excinfo.value)
|
||||
assert Organisation.query.count() == 0
|
||||
|
||||
|
||||
def test_get_organisations_gets_all_organisations(notify_db, notify_db_session):
|
||||
org_1 = create_organisation(name='test_org_1')
|
||||
org_2 = create_organisation(name='test_org_2')
|
||||
|
||||
@@ -54,7 +54,7 @@ def test_post_create_organisation(admin_request, notify_db_session):
|
||||
assert data['logo'] == response['data']['logo']
|
||||
|
||||
|
||||
def test_post_create_organisation_without_logo_raises_error(admin_request, notify_db_session):
|
||||
def test_post_create_organisation_without_logo_is_ok(admin_request, notify_db_session):
|
||||
data = {
|
||||
'name': 'test organisation',
|
||||
'colour': '#0000ff',
|
||||
@@ -62,9 +62,8 @@ def test_post_create_organisation_without_logo_raises_error(admin_request, notif
|
||||
response = admin_request.post(
|
||||
'organisation.create_organisation',
|
||||
_data=data,
|
||||
_expected_status=400
|
||||
_expected_status=201,
|
||||
)
|
||||
assert response['errors'][0]['message'] == "logo is a required property"
|
||||
|
||||
|
||||
def test_post_create_organisation_without_name_or_colour_is_valid(admin_request, notify_db_session):
|
||||
|
||||
Reference in New Issue
Block a user