{"action":"created","comment":{"url":"https://api.github.com/repos/machtfit/django-emarsys/pulls/comments/35847149","id":35847149,"diff_hunk":"@@ -0,0 +1,105 @@\n+import logging\n+\n+from django.conf import settings\n+from django.test import TestCase\n+from django.test.utils import override_settings\n+\n+from django_emarsys.test_helper import MockLoggingHandler\n+from django_emarsys import util\n+\n+\n+class ModelTestCase(TestCase):\n+    @override_settings()\n+    def test_configuration_present(self):\n+        logger = logging.getLogger(util.__file__)\n+        handler = MockLoggingHandler(level='WARNING')\n+        logger.addHandler(handler)\n+\n+        # remove all EMARSYS_* settings\n+        for symbol in dir(settings):\n+            if symbol.startswith('EMARSYS_'):\n+                delattr(settings, symbol)\n+\n+        util.validate_configuration()","path":"tests/configuration.py","position":23,"original_position":23,"commit_id":"98065bf2aeeb2cb60118f6b83ee90dab0ec8f868","original_commit_id":"ff40c3d73242d8a2a0df89658c0d6cee4493b74d","user":{"login":"or","id":6608430,"avatar_url":"https://avatars.githubusercontent.com/u/6608430?v=3","gravatar_id":"","url":"https://api.github.com/users/or","html_url":"https://github.com/or","followers_url":"https://api.github.com/users/or/followers","following_url":"https://api.github.com/users/or/following{/other_user}","gists_url":"https://api.github.com/users/or/gists{/gist_id}","starred_url":"https://api.github.com/users/or/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/or/subscriptions","organizations_url":"https://api.github.com/users/or/orgs","repos_url":"https://api.github.com/users/or/repos","events_url":"https://api.github.com/users/or/events{/privacy}","received_events_url":"https://api.github.com/users/or/received_events","type":"User","site_admin":false},"body":"How do you mean?","created_at":"2015-07-30T08:05:42Z","updated_at":"2015-07-30T08:05:42Z","html_url":"https://github.com/machtfit/django-emarsys/pull/6#discussion_r35847149","pull_request_url":"https://api.github.com/repos/machtfit/django-emarsys/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/machtfit/django-emarsys/pulls/comments/35847149"},"html":{"href":"https://github.com/machtfit/django-emarsys/pull/6#discussion_r35847149"},"pull_request":{"href":"https://api.github.com/repos/machtfit/django-emarsys/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/machtfit/django-emarsys/pulls/6","id":41141838,"html_url":"https://github.com/machtfit/django-emarsys/pull/6","diff_url":"https://github.com/machtfit/django-emarsys/pull/6.diff","patch_url":"https://github.com/machtfit/django-emarsys/pull/6.patch","issue_url":"https://api.github.com/repos/machtfit/django-emarsys/issues/6","number":6,"state":"open","locked":false,"title":"Refactor eventdata - work in progress","user":{"login":"or","id":6608430,"avatar_url":"https://avatars.githubusercontent.com/u/6608430?v=3","gravatar_id":"","url":"https://api.github.com/users/or","html_url":"https://github.com/or","followers_url":"https://api.github.com/users/or/followers","following_url":"https://api.github.com/users/or/following{/other_user}","gists_url":"https://api.github.com/users/or/gists{/gist_id}","starred_url":"https://api.github.com/users/or/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/or/subscriptions","organizations_url":"https://api.github.com/users/or/orgs","repos_url":"https://api.github.com/users/or/repos","events_url":"https://api.github.com/users/or/events{/privacy}","received_events_url":"https://api.github.com/users/or/received_events","type":"User","site_admin":false},"body":"This is far from complete, the focus is unit testing and getting the main functions covered.\r\n\r\n* deprecated models (`Event`, `EventData`, `EventInstance`, `EventInstanceData`) were stripped of their logic and left in only to keep the rest of the code happy for now, planned to be removed in the commit after data migration\r\n* implemented `NewEvent`, which will replace `EventInstance` and `EventInstanceData` and ultimately be renamed to `Event`, representing *actual* events\r\n* implemented `EmarsysEventId` as a mapping of event name to Emarsys ID, this will be synced on the fly when necessary (i.e. when there is no ID for a given event name yet)\r\n\r\nRough idea:\r\n* settings.EMARSYS_EVENTS configures all events and their expected data\r\n* `django_emarsys.util.validate_configuration` sanity checks all `EMARSYS_*` settings and should be called at the end of settings or perhaps somewhere in the build process, `tests/configuration.py` tests this functionality\r\n* `service.trigger_event` is exposed to be used by the parent code, it maps almost exactly to the former `Event.objects.trigger()`. `tests/trigger_event.py` tests this functionality\r\n\r\nOpen questions:\r\n- [ ] Is logging (error for things that will break the code, warning for things that are not perfect but not a problem) in `validate_configuration` enough or should it raise an exception if at least one error occurred?\r\n- [ ] Can the code assume `EMARSYS_*` settings are correct and use them as expected, as long as errors are caught and logged into `NewEvent` objects?\r\n\r\nIssues:\r\n- [ ] It's probably worth pondering what code belongs in Managers and what in Models and (what currently still is called) Service calls.\r\n- [ ] `NewEvent.set_data` might not be the best solution yet, because it does quite a bit, in particular things that can break, if `EMARSYS_*` settings are invalid.\r\n- [ ] Having to import `EmarsysEventId` inside `NewEventManager` to avoid circular dependencies is a bit awkward. Perhaps there's a better way.\r\n\r\nTesting:\r\n```\r\n$ py.test\r\n```\r\nIdeally for prettiness:\r\n```\r\n$ pip install git+https://github.com/or/pytest-sugar\r\n```","created_at":"2015-07-29T16:11:30Z","updated_at":"2015-07-30T08:05:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"862fcdc57bc774305ba3bfa228cffe185ed1ecd4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/machtfit/django-emarsys/pulls/6/commits","review_comments_url":"https://api.github.com/repos/machtfit/django-emarsys/pulls/6/comments","review_comment_url":"https://api.github.com/repos/machtfit/django-emarsys/pulls/comments{/number}","comments_url":"https://api.github.com/repos/machtfit/django-emarsys/issues/6/comments","statuses_url":"https://api.github.com/repos/machtfit/django-emarsys/statuses/98065bf2aeeb2cb60118f6b83ee90dab0ec8f868","head":{"label":"machtfit:refactor-eventdata","ref":"refactor-eventdata","sha":"98065bf2aeeb2cb60118f6b83ee90dab0ec8f868","user":{"login":"machtfit","id":6735834,"avatar_url":"https://avatars.githubusercontent.com/u/6735834?v=3","gravatar_id":"","url":"https://api.github.com/users/machtfit","html_url":"https://github.com/machtfit","followers_url":"https://api.github.com/users/machtfit/followers","following_url":"https://api.github.com/users/machtfit/following{/other_user}","gists_url":"https://api.github.com/users/machtfit/gists{/gist_id}","starred_url":"https://api.github.com/users/machtfit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/machtfit/subscriptions","organizations_url":"https://api.github.com/users/machtfit/orgs","repos_url":"https://api.github.com/users/machtfit/repos","events_url":"https://api.github.com/users/machtfit/events{/privacy}","received_events_url":"https://api.github.com/users/machtfit/received_events","type":"Organization","site_admin":false},"repo":{"id":27597223,"name":"django-emarsys","full_name":"machtfit/django-emarsys","owner":{"login":"machtfit","id":6735834,"avatar_url":"https://avatars.githubusercontent.com/u/6735834?v=3","gravatar_id":"","url":"https://api.github.com/users/machtfit","html_url":"https://github.com/machtfit","followers_url":"https://api.github.com/users/machtfit/followers","following_url":"https://api.github.com/users/machtfit/following{/other_user}","gists_url":"https://api.github.com/users/machtfit/gists{/gist_id}","starred_url":"https://api.github.com/users/machtfit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/machtfit/subscriptions","organizations_url":"https://api.github.com/users/machtfit/orgs","repos_url":"https://api.github.com/users/machtfit/repos","events_url":"https://api.github.com/users/machtfit/events{/privacy}","received_events_url":"https://api.github.com/users/machtfit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/machtfit/django-emarsys","description":"Emarsys for Django and Oscar","fork":false,"url":"https://api.github.com/repos/machtfit/django-emarsys","forks_url":"https://api.github.com/repos/machtfit/django-emarsys/forks","keys_url":"https://api.github.com/repos/machtfit/django-emarsys/keys{/key_id}","collaborators_url":"https://api.github.com/repos/machtfit/django-emarsys/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/machtfit/django-emarsys/teams","hooks_url":"https://api.github.com/repos/machtfit/django-emarsys/hooks","issue_events_url":"https://api.github.com/repos/machtfit/django-emarsys/issues/events{/number}","events_url":"https://api.github.com/repos/machtfit/django-emarsys/events","assignees_url":"https://api.github.com/repos/machtfit/django-emarsys/assignees{/user}","branches_url":"https://api.github.com/repos/machtfit/django-emarsys/branches{/branch}","tags_url":"https://api.github.com/repos/machtfit/django-emarsys/tags","blobs_url":"https://api.github.com/repos/machtfit/django-emarsys/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/machtfit/django-emarsys/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/machtfit/django-emarsys/git/refs{/sha}","trees_url":"https://api.github.com/repos/machtfit/django-emarsys/git/trees{/sha}","statuses_url":"https://api.github.com/repos/machtfit/django-emarsys/statuses/{sha}","languages_url":"https://api.github.com/repos/machtfit/django-emarsys/languages","stargazers_url":"https://api.github.com/repos/machtfit/django-emarsys/stargazers","contributors_url":"https://api.github.com/repos/machtfit/django-emarsys/contributors","subscribers_url":"https://api.github.com/repos/machtfit/django-emarsys/subscribers","subscription_url":"https://api.github.com/repos/machtfit/django-emarsys/subscription","commits_url":"https://api.github.com/repos/machtfit/django-emarsys/commits{/sha}","git_commits_url":"https://api.github.com/repos/machtfit/django-emarsys/git/commits{/sha}","comments_url":"https://api.github.com/repos/machtfit/django-emarsys/comments{/number}","issue_comment_url":"https://api.github.com/repos/machtfit/django-emarsys/issues/comments{/number}","contents_url":"https://api.github.com/repos/machtfit/django-emarsys/contents/{+path}","compare_url":"https://api.github.com/repos/machtfit/django-emarsys/compare/{base}...{head}","merges_url":"https://api.github.com/repos/machtfit/django-emarsys/merges","archive_url":"https://api.github.com/repos/machtfit/django-emarsys/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/machtfit/django-emarsys/downloads","issues_url":"https://api.github.com/repos/machtfit/django-emarsys/issues{/number}","pulls_url":"https://api.github.com/repos/machtfit/django-emarsys/pulls{/number}","milestones_url":"https://api.github.com/repos/machtfit/django-emarsys/milestones{/number}","notifications_url":"https://api.github.com/repos/machtfit/django-emarsys/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/machtfit/django-emarsys/labels{/name}","releases_url":"https://api.github.com/repos/machtfit/django-emarsys/releases{/id}","created_at":"2014-12-05T15:24:36Z","updated_at":"2015-05-07T11:31:17Z","pushed_at":"2015-07-29T18:12:08Z","git_url":"git://github.com/machtfit/django-emarsys.git","ssh_url":"git@github.com:machtfit/django-emarsys.git","clone_url":"https://github.com/machtfit/django-emarsys.git","svn_url":"https://github.com/machtfit/django-emarsys","homepage":null,"size":404,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"machtfit:master","ref":"master","sha":"b0d281f0bf505ab48ae52fa91955433ab4741222","user":{"login":"machtfit","id":6735834,"avatar_url":"https://avatars.githubusercontent.com/u/6735834?v=3","gravatar_id":"","url":"https://api.github.com/users/machtfit","html_url":"https://github.com/machtfit","followers_url":"https://api.github.com/users/machtfit/followers","following_url":"https://api.github.com/users/machtfit/following{/other_user}","gists_url":"https://api.github.com/users/machtfit/gists{/gist_id}","starred_url":"https://api.github.com/users/machtfit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/machtfit/subscriptions","organizations_url":"https://api.github.com/users/machtfit/orgs","repos_url":"https://api.github.com/users/machtfit/repos","events_url":"https://api.github.com/users/machtfit/events{/privacy}","received_events_url":"https://api.github.com/users/machtfit/received_events","type":"Organization","site_admin":false},"repo":{"id":27597223,"name":"django-emarsys","full_name":"machtfit/django-emarsys","owner":{"login":"machtfit","id":6735834,"avatar_url":"https://avatars.githubusercontent.com/u/6735834?v=3","gravatar_id":"","url":"https://api.github.com/users/machtfit","html_url":"https://github.com/machtfit","followers_url":"https://api.github.com/users/machtfit/followers","following_url":"https://api.github.com/users/machtfit/following{/other_user}","gists_url":"https://api.github.com/users/machtfit/gists{/gist_id}","starred_url":"https://api.github.com/users/machtfit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/machtfit/subscriptions","organizations_url":"https://api.github.com/users/machtfit/orgs","repos_url":"https://api.github.com/users/machtfit/repos","events_url":"https://api.github.com/users/machtfit/events{/privacy}","received_events_url":"https://api.github.com/users/machtfit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/machtfit/django-emarsys","description":"Emarsys for Django and Oscar","fork":false,"url":"https://api.github.com/repos/machtfit/django-emarsys","forks_url":"https://api.github.com/repos/machtfit/django-emarsys/forks","keys_url":"https://api.github.com/repos/machtfit/django-emarsys/keys{/key_id}","collaborators_url":"https://api.github.com/repos/machtfit/django-emarsys/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/machtfit/django-emarsys/teams","hooks_url":"https://api.github.com/repos/machtfit/django-emarsys/hooks","issue_events_url":"https://api.github.com/repos/machtfit/django-emarsys/issues/events{/number}","events_url":"https://api.github.com/repos/machtfit/django-emarsys/events","assignees_url":"https://api.github.com/repos/machtfit/django-emarsys/assignees{/user}","branches_url":"https://api.github.com/repos/machtfit/django-emarsys/branches{/branch}","tags_url":"https://api.github.com/repos/machtfit/django-emarsys/tags","blobs_url":"https://api.github.com/repos/machtfit/django-emarsys/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/machtfit/django-emarsys/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/machtfit/django-emarsys/git/refs{/sha}","trees_url":"https://api.github.com/repos/machtfit/django-emarsys/git/trees{/sha}","statuses_url":"https://api.github.com/repos/machtfit/django-emarsys/statuses/{sha}","languages_url":"https://api.github.com/repos/machtfit/django-emarsys/languages","stargazers_url":"https://api.github.com/repos/machtfit/django-emarsys/stargazers","contributors_url":"https://api.github.com/repos/machtfit/django-emarsys/contributors","subscribers_url":"https://api.github.com/repos/machtfit/django-emarsys/subscribers","subscription_url":"https://api.github.com/repos/machtfit/django-emarsys/subscription","commits_url":"https://api.github.com/repos/machtfit/django-emarsys/commits{/sha}","git_commits_url":"https://api.github.com/repos/machtfit/django-emarsys/git/commits{/sha}","comments_url":"https://api.github.com/repos/machtfit/django-emarsys/comments{/number}","issue_comment_url":"https://api.github.com/repos/machtfit/django-emarsys/issues/comments{/number}","contents_url":"https://api.github.com/repos/machtfit/django-emarsys/contents/{+path}","compare_url":"https://api.github.com/repos/machtfit/django-emarsys/compare/{base}...{head}","merges_url":"https://api.github.com/repos/machtfit/django-emarsys/merges","archive_url":"https://api.github.com/repos/machtfit/django-emarsys/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/machtfit/django-emarsys/downloads","issues_url":"https://api.github.com/repos/machtfit/django-emarsys/issues{/number}","pulls_url":"https://api.github.com/repos/machtfit/django-emarsys/pulls{/number}","milestones_url":"https://api.github.com/repos/machtfit/django-emarsys/milestones{/number}","notifications_url":"https://api.github.com/repos/machtfit/django-emarsys/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/machtfit/django-emarsys/labels{/name}","releases_url":"https://api.github.com/repos/machtfit/django-emarsys/releases{/id}","created_at":"2014-12-05T15:24:36Z","updated_at":"2015-05-07T11:31:17Z","pushed_at":"2015-07-29T18:12:08Z","git_url":"git://github.com/machtfit/django-emarsys.git","ssh_url":"git@github.com:machtfit/django-emarsys.git","clone_url":"https://github.com/machtfit/django-emarsys.git","svn_url":"https://github.com/machtfit/django-emarsys","homepage":null,"size":404,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/machtfit/django-emarsys/pulls/6"},"html":{"href":"https://github.com/machtfit/django-emarsys/pull/6"},"issue":{"href":"https://api.github.com/repos/machtfit/django-emarsys/issues/6"},"comments":{"href":"https://api.github.com/repos/machtfit/django-emarsys/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/machtfit/django-emarsys/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/machtfit/django-emarsys/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/machtfit/django-emarsys/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/machtfit/django-emarsys/statuses/98065bf2aeeb2cb60118f6b83ee90dab0ec8f868"}}}}