def test_validate_name_uniqness(self, valid_application): app = Application() app.slug = valid_application.slug with pytest.raises(ValidationError) as e: app.full_clean() assert "'slug': " in str(e.value)
def test_can_not_create_empty_application(self): with pytest.raises(ValidationError) as e: a = Application() a.full_clean() # assert "'slug'" in str(e.value) assert "'title'" in str(e.value) assert "'url'" in str(e.value) assert "'notes'" in str(e.value)
def valid_application(): a = Application() a.slug = "test-name" a.title = "Test name" a.notes = "Treść" a.url = "http://smth.smwheere.com" a.status = 'published' a.save() return a
def _valid_application2(): app2 = Application() app2.title = "Second application" app2.slug = "app2" app2.url = "http://second.app.com" app2.status = 'published' app2.save() return app2
def test_create_application(self): a = Application() a.slug = "test-name" a.title = "Test name" a.notes = "Treść" a.url = "http://smth.smwheere.com" # a.status = 'active' assert a.full_clean() is None assert a.id is None a.save() assert a.id is not None assert a.status == "published"
def valid_application_with_logo(small_image): app = Application() app.title = "Application with logo" app.slug = "app-logo" app.url = "http://logo.app.com" app.status = 'published' app.image = small_image app.save() return app
def unsave_application(): a = Application() a.slug = "test-name" a.title = "Test name" a.url = "http://smth.smwheere.com" return a
def applications_list(): app2 = Application() app2.title = "Second application" app2.slug = "app2" app2.url = "http://second.app.com" app2.status = 'published' app2.save() del_app = Application() del_app.title = "Deleted application" del_app.slug = "app-del" del_app.url = "http://deleted.app.com" del_app.status = 'published' del_app.save() del_app.delete() app_last = Application() app_last.title = "Last application" app_last.slug = "app-last" app_last.url = "http://last.app.com" app_last.status = 'published' app_last.save() return [valid_application(), app2, del_app, app_last]